Jenkins scripted multibranch pipeline

This commit is contained in:
Dominik Chilla 2019-06-14 22:40:28 +02:00
parent 7c47f9765f
commit d780007d2c

6
Jenkinsfile vendored
View File

@ -2,7 +2,8 @@ pipeline {
agent any agent any
parameters { parameters {
string name: 'dockerRegistry', trim: true string defaultValue: 'https', name: 'dockerRegistryScheme', trim: true
string defaultValue: 'change.me', name: 'dockerRegistryRepo', trim: true
} }
environment { environment {
@ -36,7 +37,7 @@ pipeline {
stage('Push image') { stage('Push image') {
steps { steps {
script { script {
docker.withRegistry(env.dockerRegistry) { docker.withRegistry("${env.dockerRegistryScheme}://${env.dockerRegistryRepo}") {
dockerImage.push() dockerImage.push()
} }
} }
@ -45,6 +46,7 @@ pipeline {
stage('Cleanup') { stage('Cleanup') {
steps { steps {
sh '/usr/bin/docker rmi -f "${imageName}:${BRANCH_NAME}"' sh '/usr/bin/docker rmi -f "${imageName}:${BRANCH_NAME}"'
sh '/usr/bin/docker rmi -f "${dockerRegistryRepo}/${imageName}:${BRANCH_NAME}"'
} }
} }
} }