diff --git a/Jenkinsfile b/Jenkinsfile index 3a5879c9b..1e6a8a5b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,11 +39,12 @@ pipeline { } steps { checkout scm - - def docker_image=docker.build("mr:8084/spring-petclinic:$GIT_COMMIT") - sh 'docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS" mr:8084' - docker.withRegistry('mr:8084') { - docker_image.push() + script { + def docker_image=docker.build("mr:8084/spring-petclinic:$GIT_COMMIT") + sh 'docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS" mr:8084' + docker.withRegistry('mr:8084') { + docker_image.push() + } } } }