From c074b6e549f17537651b940a5ebc4f93f3e87684 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 09:03:35 +0000 Subject: [PATCH] jenkins: fix syntax #2 --- Jenkinsfile.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index d272c7c..8d193dd 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -12,11 +12,14 @@ pipeline { } stage('no SNAPSHOT in master') { // checks that the pom version is not a snapshot when the current branch is master - when { expression { (env.GIT_BRANCH == 'master') } } + // TODO: also check for SNAPSHOT when is a pull request with master as the target branch + when { + expression { + (env.GIT_BRANCH == 'master') && + (pom.version).contains("SNAPSHOT") } + } steps { - if ((pom.version).contains("SNAPSHOT")) { - error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") - } + error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") } } stage('Build') {