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') {