Jenkins Multi-Branch build

This commit is contained in:
Dominik Chilla 2019-06-14 18:28:45 +02:00
parent 05382b2156
commit 0751c7ba4c

View File

@ -3,6 +3,11 @@ pipeline {
dockerImage = '' dockerImage = ''
} }
parameters {
string name: 'imageName', trim: false
string name: 'dockerRegistry', trim: false
}
agent any agent any
stages { stages {
@ -10,7 +15,8 @@ pipeline {
steps { steps {
sh '/usr/bin/env' sh '/usr/bin/env'
script { script {
dockerImage = docker.build("${env.imageName}:${env.GIT_LOCAL_BRANCH}","--pull --label \\\"GIT_COMMIT=${env.GIT_COMMIT}\\\" --label \\\"BUILD_URL=${env.BUILD_URL}\\\" .") /* Multi-Branch Pipeline works with env.BRANCH_NAME*/
dockerImage = docker.build("${env.imageName}:${env.BRANCH_NAME}","--pull --label BUILD_URL=${env.BUILD_URL} .")
} }
} }
} }
@ -18,7 +24,7 @@ pipeline {
stage('Test image') { stage('Test image') {
steps { steps {
script { script {
dockerImage.inside { c -> dockerImage.inside {
sh '/usr/bin/env' sh '/usr/bin/env'
sh '/bin/ps auxwwf' sh '/bin/ps auxwwf'
} }