Skip to content

Commit 5de6b69

Browse files
committed
Backport CI release script improvements
1 parent 0755134 commit 5de6b69

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

ci/release/Jenkinsfile

+30-26
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/*
1010
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers
1111
*/
12-
@Library('hibernate-jenkins-pipeline-helpers@1.14') _
12+
@Library('hibernate-jenkins-pipeline-helpers@1.17') _
1313

1414
import org.hibernate.jenkins.pipeline.helpers.version.Version
1515

@@ -48,8 +48,8 @@ if ( !manualRelease && !RELEASE_ON_PUSH ) {
4848
def checkoutReleaseScripts() {
4949
dir('.release/scripts') {
5050
checkout scmGit(branches: [[name: '*/main']], extensions: [],
51-
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com',
52-
url: 'https://github.com/hibernate/hibernate-release-scripts.git']])
51+
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com',
52+
url: 'https://github.com/hibernate/hibernate-release-scripts.git']])
5353
}
5454
}
5555

@@ -107,11 +107,11 @@ pipeline {
107107
echo "Release was requested manually"
108108

109109
if ( !params.RELEASE_VERSION ) {
110-
throw new IllegalArgumentException( 'Missing value for parameter RELEASE_VERSION. This parameter must be set explicitly to prevent mistakes.' )
110+
throw new IllegalArgumentException( 'Missing value for parameter RELEASE_VERSION. This parameter must be set explicitly to prevent mistakes.' )
111111
}
112112
releaseVersion = Version.parseReleaseVersion( params.RELEASE_VERSION )
113113

114-
if ( releaseVersion.toString().startsWith( currentVersion.family + '.' ) ) {
114+
if ( !releaseVersion.toString().startsWith( currentVersion.family + '.' ) ) {
115115
throw new IllegalArgumentException( "RELEASE_VERSION = $releaseVersion, which is different from the family of CURRENT_VERSION = $currentVersion. Did you make a mistake?" )
116116
}
117117
}
@@ -147,12 +147,10 @@ pipeline {
147147

148148
env.RELEASE_VERSION = releaseVersion.toString()
149149
env.DEVELOPMENT_VERSION = developmentVersion.toString()
150-
def versionBasis = releaseVersion.unqualified
151-
152150
env.SCRIPT_OPTIONS = params.RELEASE_DRY_RUN ? "-d" : ""
153151

154152
// Determine version id to check if Jira version exists
155-
sh ".release/scripts/determine-jira-version-id.sh ${env.JIRA_KEY} ${versionBasis}"
153+
sh ".release/scripts/determine-jira-version-id.sh ${env.JIRA_KEY} ${releaseVersion.withoutFinalQualifier}"
156154
}
157155
}
158156
}
@@ -166,17 +164,23 @@ pipeline {
166164
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
167165
]) {
168166
withCredentials([
169-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
170-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
171-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
172-
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE')
167+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
168+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
169+
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
170+
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE')
173171
]) {
174172
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
175173
// set release version
176174
// update changelog from JIRA
177175
// tags the version
178176
// changes the version to the provided development version
179-
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
177+
withEnv([
178+
"BRANCH=${env.GIT_BRANCH}",
179+
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
180+
"GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
181+
]) {
182+
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
183+
}
180184
}
181185
}
182186
}
@@ -193,16 +197,16 @@ pipeline {
193197
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
194198
]) {
195199
withCredentials([
196-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
197-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
198-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
199-
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE'),
200-
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
200+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
201+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
202+
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
203+
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE'),
204+
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
201205
]) {
202206
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
203207
// performs documentation upload and Sonatype release
204208
// push to github
205-
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
209+
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
206210
}
207211
}
208212
}
@@ -247,11 +251,11 @@ pipeline {
247251
}
248252
}
249253
}
250-
post {
251-
always {
252-
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
253-
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
254-
}
255-
}
256-
}
254+
post {
255+
always {
256+
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
257+
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
258+
}
259+
}
260+
}
257261
}

0 commit comments

Comments
 (0)