Skip to content

Commit e9f22fb

Browse files
committed
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 a Jira key in the commit message.
1 parent 9a9ca12 commit e9f22fb

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

ci/release/Jenkinsfile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ pipeline {
116116
def releaseVersion
117117
def developmentVersion
118118

119-
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true).trim()
120-
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true).trim()
121-
def isCiLastCommiter = lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI'
122-
123-
echo "Last two commits were performed by '${lastCommitter}'/'${secondLastCommitter}'."
124-
echo "Is 'Hibernate-CI' the last commiter: '${isCiLastCommiter}'."
125-
126119
if ( manualRelease ) {
127120
echo "Release was requested manually"
128121

@@ -140,10 +133,13 @@ pipeline {
140133
else {
141134
echo "Release was triggered automatically"
142135

143-
// Avoid doing an automatic release for commits from a release
144-
145-
if (isCiLastCommiter) {
146-
print "INFO: Automatic release skipped because last commits were for the previous release"
136+
// Avoid doing an automatic release if there are no "releasable" commits since the last release (see release scripts for determination)
137+
def releasableCommitCount = sh(
138+
script: ".release/scripts/count-releasable-commits.sh ${env.PROJECT}",
139+
returnStdout: true
140+
).trim().toInteger()
141+
if ( releasableCommitCount <= 0 ) {
142+
print "INFO: Automatic release skipped because no releasable commits were pushed since the previous release"
147143
currentBuild.getRawBuild().getExecutor().interrupt(Result.NOT_BUILT)
148144
sleep(1) // Interrupt is not blocking and does not take effect immediately.
149145
return

0 commit comments

Comments
 (0)