/
pipeline.groovy
50 lines (50 loc) · 1.46 KB
/
pipeline.groovy
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
45
46
47
48
49
50
pipeline {
agent any
stages {
stage('Prepare') {
steps {
echo 'Prepare'
}
}
stage('Certify Docker Image') {
steps {
withCredentials([usernamePassword(credentialsId: 'OCIR', passwordVariable: 'OCIR_PW', usernameVariable: 'OCIR_UN')]) {
sh 'docker login -u $OCIR_UN -p $OCIR_PW iad.ocir.io '
sh 'docker tag $ARTI3REGISTRY/michaelhuettermann/alpine-tomcat7:$version iad.ocir.io/mh/michaelhuettermann/alpine-tomcat7:$version'
sh 'docker images'
}
}
}
stage('Promote Docker Image to Registry') {
steps {
sh 'docker push iad.ocir.io/mh/michaelhuettermann/alpine-tomcat7:$version'
}
}
stage('Deploy to Production') {
steps {
script {
build(job: "Project-Cloud-Deploy", parameters: [[$class: 'StringParameterValue', name: 'version', value: "$version" ]], wait: false)
}
}
}
}
post {
always {
echo 'Finished!'
sh 'docker logout iad.ocir.io'
deleteDir()
}
success {
echo 'Succeeeded.'
}
unstable {
echo 'Unstable.'
}
failure {
echo 'Failed.'
}
changed {
echo 'Things in life change.'
}
}
}