Jenkins multibranch pipeline

This commit is contained in:
Dominik Chilla 2019-06-14 21:19:44 +02:00
parent 0328bd1a6c
commit 2876c35ffa

View File

@ -1,18 +1,15 @@
def dockerImage = ''
pipeline { pipeline {
agent any agent any
environment {
dockerImage = ''
imageName = 'sos-milter'
}
stages { stages {
stage('Build image') { stage('Build image') {
steps { steps {
sh '/usr/bin/env' sh '/usr/bin/env'
script { script {
/* Multi-Branch Pipeline works with env.BRANCH_NAME*/ /* Multi-Branch Pipeline works with env.BRANCH_NAME*/
dockerImage = docker.build("${env.imageName}:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .") dockerImage = docker.build("sos-milter:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .")
} }
} }
} }
@ -29,9 +26,7 @@ pipeline {
stage('Push image') { stage('Push image') {
steps { steps {
script { script {
docker.withRegistry('https://dockreg-fra.zwackl.de') { dockerImage.push()
dockerImage.push()
}
} }
} }
} }
@ -42,3 +37,4 @@ pipeline {
} }
} }
} }