-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
44 lines (44 loc) · 1.07 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pipeline {
agent any
tools{
maven 'M2-HOME'
}
environment {
registry = '578022945257.dkr.ecr.us-east-1.amazonaws.com/devops_repo'
registryCredential = 'jenkins-ecr'
dockerimage = ''
}
stages {
stage('Checkout'){
steps{
git branch: 'main', url: 'https://github.com/Hermann90/helloworld_jan_22.git'
}
}
stage('Code Build') {
steps {
sh 'mvn clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Build Image') {
steps {
script{
dockerImage = docker.build registry + ":$BUILD_NUMBER"
}
}
}
stage('Deploy image') {
steps{
script{
docker.withRegistry("https://"+registry,"ecr:us-east-1:"+registryCredential) {
dockerImage.push()
}
}
}
}
}
}