-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_CD
33 lines (32 loc) · 984 Bytes
/
Jenkinsfile_CD
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
pipeline {
agent {
label 'linux-node'
}
stages {
stage('deploy') {
steps {
script{
def result = sh(script: """sudo docker ps -a | grep $env.ENVIRONMENT | wc -l""", returnStdout: true).trim()
sh "echo $result"
if ("${result}" != "0"){
sh "sudo docker rm $env.ENVIRONMENT -f"
}
}
}
post{
always{
script{
sh "sudo docker pull mukovozovbohdan/petclinic:$env.Image"
sh "sudo docker run -d --name $env.ENVIRONMENT -p $env.PORT:8080 mukovozovbohdan/petclinic:$env.Image"
}
sleep(20)
}
}
}
stage('healthcheck') {
steps{
sh "curl -Is http://15.188.246.227:$env.PORT/"
}
}
}
}