Jenkins parameterized

This commit is contained in:
Dominik Chilla 2019-06-13 22:34:12 +02:00
parent 33dd8ec7b2
commit f0382262e2

View File

@ -1,6 +1,6 @@
pipeline { pipeline {
environment { environment {
imageObject = '' dockerImage = ''
} }
agent any agent any
@ -12,7 +12,7 @@ pipeline {
/* This builds the actual image; synonymous to /* This builds the actual image; synonymous to
* docker build on the command line */ * docker build on the command line */
script { script {
imageObject = docker.build(env.imageName) dockerImage = docker.build("${env.imageName}:${env.GIT_LOCAL_BRANCH}")
} }
} }
} }
@ -22,7 +22,7 @@ pipeline {
/* Ideally, we would run a test framework against our image. /* Ideally, we would run a test framework against our image.
* For this example, we're using a Volkswagen-type approach ;-) */ * For this example, we're using a Volkswagen-type approach ;-) */
script { script {
imageObject.inside { dockerImage.inside {
sh 'echo "Tests passed"' sh 'echo "Tests passed"'
} }
} }
@ -33,7 +33,7 @@ pipeline {
steps { steps {
script { script {
docker.withRegistry(env.dockerRegistry) { docker.withRegistry(env.dockerRegistry) {
imageObject.push() dockerImage.push()
} }
} }
} }