Skip to content

Commit 65cf39b

Browse files
marko-bekhtambellade
authored andcommitted
Test the ci-commiter before checking the release type (manual/automatic)
1 parent 587d552 commit 65cf39b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ci/release/Jenkinsfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ 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+
118125
if ( manualRelease ) {
119126
echo "Release was requested manually"
120127

@@ -133,9 +140,8 @@ pipeline {
133140
echo "Release was triggered automatically"
134141

135142
// Avoid doing an automatic release for commits from a release
136-
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true)
137-
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true)
138-
if (lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI') {
143+
144+
if (isCiLastCommiter) {
139145
print "INFO: Automatic release skipped because last commits were for the previous release"
140146
currentBuild.getRawBuild().getExecutor().interrupt(Result.NOT_BUILT)
141147
sleep(1) // Interrupt is not blocking and does not take effect immediately.

0 commit comments

Comments
 (0)