Skip to content

Commit 163359f

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 9be7485 commit 163359f

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
@@ -115,13 +115,6 @@ pipeline {
115115
def releaseVersion
116116
def developmentVersion
117117

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

@@ -139,10 +132,13 @@ pipeline {
139132
else {
140133
echo "Release was triggered automatically"
141134

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

0 commit comments

Comments
 (0)