From 997e08458e9645106206427eaa1a9d86afb73c68 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 8 Mar 2018 18:56:59 +0000 Subject: [PATCH] jenkins: checkfor SNAPSHOT when pull request into master --- Jenkinsfile.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 26d3c15..0e9f8ea 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -3,17 +3,16 @@ final String mvn = "mvn --batch-mode --update-snapshots" pipeline { agent any stages { - stage('dump environment') { + stage('Environment') { steps { sh 'set' } } stage('no SNAPSHOT in master') { - // checks that the pom version is not a snapshot when the current branch is master - // TODO: also check for SNAPSHOT when is a pull request with master as the target branch + // checks that the pom version is not a snapshot when the current or target branch is master when { expression { - (env.GIT_BRANCH == 'master') && + (env.GIT_BRANCH == 'master' || env.CHANGE_TARGET == 'master') && (readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") } } steps {