Skip to content

Commit 737b4cf

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 050c5e5 commit 737b4cf

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

ci/release/Jenkinsfile

Lines changed: 36 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

@@ -214,6 +215,33 @@ pipeline {
214215
}
215216
}
216217
}
218+
stage('Update website') {
219+
steps {
220+
script {
221+
checkoutReleaseScripts()
222+
223+
configFileProvider([
224+
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
225+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
226+
]) {
227+
withCredentials([
228+
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
229+
]) {
230+
sshagent( ['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net'] ) {
231+
dir( '.release/hibernate.org' ) {
232+
checkout scmGit(
233+
branches: [[name: '*/production']],
234+
extensions: [],
235+
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com', url: 'https://github.com/hibernate/hibernate.org.git']]
236+
)
237+
sh "../scripts/website-release.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION}"
238+
}
239+
}
240+
}
241+
}
242+
}
243+
}
244+
}
217245
}
218246
post {
219247
always {

0 commit comments

Comments
 (0)