jenkins: add check to fail build when SNAPSHOT on master branch

This commit is contained in:
Paul Campbell 2018-03-03 08:46:47 +00:00
parent 463d633ed9
commit e6e022381c

View file

@ -9,6 +9,16 @@ pipeline {
git url: gitRepoUrl, branch: '**', credentialsId: 'github-kemitix' 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') { stage('Build') {
parallel { parallel {
stage('Java 8') { stage('Java 8') {