From 604af1c2c2c49a5172b87aec6842ea84d0e4a94b Mon Sep 17 00:00:00 2001 From: surtexx <91895868+surtexx@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:59:26 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 996d5f39d..334308e2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,12 @@ pipeline{ agent any - when { - expression { - return env.CHANGE_ID != null - } - } stages { stage ("build") { + when { + expression { + return env.CHANGE_ID != null + } + } steps { echo "Running build automation..." sh './mvnw checkstyle:checkstyle' @@ -15,6 +15,11 @@ pipeline{ } } stage ("Build Docker Image") { + when { + expression { + return env.CHANGE_ID != null + } + } steps { script{ app = docker.build("surtexx/mr:${GIT_COMMIT[0..7]}", "-f Dockerfile1 .") @@ -22,6 +27,11 @@ pipeline{ } } stage ("Push Docker Image") { + when { + expression { + return env.CHANGE_ID != null + } + } steps { script{ docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') { @@ -36,11 +46,11 @@ pipeline{ pipeline{ agent any - when{ - branch: 'main' - } stages{ stage ("Build Docker Image") { + when{ + branch: 'main' + } steps { script{ app = docker.build("surtexx/main", "-f Dockerfile1 .") @@ -48,6 +58,9 @@ pipeline{ } } stage ("Push Docker Image") { + when{ + branch: 'main' + } steps { script{ docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {