From e6e022381c4e12747cabcce607ed2034f28a4159 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 3 Mar 2018 08:46:47 +0000 Subject: [PATCH] jenkins: add check to fail build when SNAPSHOT on master branch --- Jenkinsfile.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index 3f87b24..d66f124 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -9,6 +9,16 @@ pipeline { git url: gitRepoUrl, branch: '**', credentialsId: 'github-kemitix' } } + 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') } + steps { + def pom = readMavenPom file: 'pom.xml' + if ((pom.version).contains("SNAPSHOT")) { + error("Build failed because SNAPSHOT version: ${pom.groupId}:${pom.artifactId}:${pom.version}") + } + } + } stage('Build') { parallel { stage('Java 8') {