Release Jenkinsfile: explicitly skip automatic releases for non-maintenance branches
This commit is contained in:
parent
5f0fbc48be
commit
978860f01d
|
@ -95,11 +95,18 @@ pipeline {
|
||||||
else {
|
else {
|
||||||
echo "Release was triggered automatically"
|
echo "Release was triggered automatically"
|
||||||
|
|
||||||
// Avoid doing a release for commits from a release
|
// Avoid doing an automatic release on a non-maintenance branch
|
||||||
|
if ( ! ( env.BRANCH_NAME ==~ /^\d+\.\d+$/ ) ) {
|
||||||
|
print "INFO: Automatic release skipped because the branch name doesn't follow pattern /^\\d+\\.\\d+\$/"
|
||||||
|
currentBuild.result = 'ABORTED'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avoid doing an automatic release for commits from a release
|
||||||
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true)
|
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true)
|
||||||
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true)
|
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true)
|
||||||
if (lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI') {
|
if (lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI') {
|
||||||
print "INFO: Build skipped because last commits were for the previous release"
|
print "INFO: Automatic release skipped because last commits were for the previous release"
|
||||||
currentBuild.result = 'ABORTED'
|
currentBuild.result = 'ABORTED'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue