Skip to content

Commit 3674647

Browse files
committed
Release job: Avoid auto-release when there are no "releasable" commits
The determination of "releasable" is in the release scripts, but currently it boils down to having an issue key in the commit message.
1 parent fecd18c commit 3674647

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ci/release/Jenkinsfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,15 @@ pipeline {
122122
else {
123123
echo "Release was triggered automatically"
124124

125-
// Avoid doing an automatic release for commits from a release
126-
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true).trim()
127-
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true).trim()
128-
echo "Last two commits were performed by '${lastCommitter}'/'${secondLastCommitter}'."
129-
130-
if (lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI') {
131-
print "INFO: Automatic release skipped because last commits were for the previous release"
132-
currentBuild.result = 'ABORTED'
125+
// Avoid doing an automatic release if there are no "releasable" commits since the last release (see release scripts for determination)
126+
def releasableCommitCount = sh(
127+
script: ".release/scripts/count-releasable-commits.sh ${env.PROJECT}",
128+
returnStdout: true
129+
).trim().toInteger()
130+
if ( releasableCommitCount <= 0 ) {
131+
print "INFO: Automatic release skipped because no releasable commits were pushed since the previous release"
132+
currentBuild.getRawBuild().getExecutor().interrupt(Result.NOT_BUILT)
133+
sleep(1) // Interrupt is not blocking and does not take effect immediately.
133134
return
134135
}
135136

0 commit comments

Comments
 (0)