Skip to content

Commit 3a8dee7

Browse files
committed
Update the order of release steps and simplify the ORM build script [HHH-19913]
1 parent 54f8c25 commit 3a8dee7

File tree

3 files changed

+104
-306
lines changed

3 files changed

+104
-306
lines changed

ci/release/Jenkinsfile

Lines changed: 99 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -176,92 +176,111 @@ pipeline {
176176
script {
177177
checkoutReleaseScripts()
178178

179-
configFileProvider([
180-
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
181-
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
182-
]) {
183-
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
184-
// set release version
185-
// update changelog from JIRA
186-
// tags the version
187-
// changes the version to the provided development version
188-
withEnv([
189-
"DISABLE_REMOTE_GRADLE_CACHE=true",
190-
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
191-
"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'"
192-
]) {
193-
sh ".release/scripts/prepare-release.sh -j -b ${env.GIT_BRANCH} -v ${env.DEVELOPMENT_VERSION} ${env.PROJECT} ${env.RELEASE_VERSION}"
194-
}
195-
}
196-
}
197-
}
198-
}
199-
}
200-
stage('Publish release') {
201-
steps {
202-
script {
203-
checkoutReleaseScripts()
179+
configFileProvider([
180+
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
181+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
182+
]) {
183+
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate-ci.frs.sourceforge.net']) {
184+
// set release version
185+
// update changelog from JIRA
186+
// tags the version
187+
// changes the version to the provided development version
188+
withEnv([
189+
"DISABLE_REMOTE_GRADLE_CACHE=true",
190+
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
191+
"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'"
192+
]) {
193+
sh ".release/scripts/prepare-release.sh -j -b ${env.GIT_BRANCH} -v ${env.DEVELOPMENT_VERSION} ${env.PROJECT} ${env.RELEASE_VERSION}"
194+
}
195+
}
196+
}
197+
}
198+
}
199+
}
200+
stage('Publish') {
201+
steps {
202+
script {
203+
checkoutReleaseScripts()
204204

205-
configFileProvider([
206-
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
207-
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
208-
]) {
209-
withCredentials([
210-
usernamePassword(credentialsId: 'central.sonatype.com', passwordVariable: 'JRELEASER_MAVENCENTRAL_TOKEN', usernameVariable: 'JRELEASER_MAVENCENTRAL_USERNAME'),
211-
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
212-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
213-
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default'),
214-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
215-
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
216-
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')
217-
]) {
218-
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
219-
// performs documentation upload and Sonatype release
220-
// push to github
221-
withEnv([
222-
"DISABLE_REMOTE_GRADLE_CACHE=true"
223-
]) {
224-
sh ".release/scripts/publish.sh -j ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
225-
}
226-
}
227-
}
228-
}
229-
}
230-
}
231-
}
232-
stage('Website release') {
233-
steps {
234-
script {
235-
checkoutReleaseScripts()
205+
configFileProvider([
206+
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
207+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
208+
]) {
209+
withCredentials([
210+
usernamePassword(credentialsId: 'central.sonatype.com', passwordVariable: 'JRELEASER_MAVENCENTRAL_TOKEN', usernameVariable: 'JRELEASER_MAVENCENTRAL_USERNAME'),
211+
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
212+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
213+
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default'),
214+
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
215+
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
216+
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')
217+
]) {
218+
sshagent(['ed25519.Hibernate-CI.github.com', 'jenkins.in.relation.to', 'hibernate-ci.frs.sourceforge.net']) {
219+
// performs documentation upload and Sonatype release
220+
// push to github
221+
withEnv([
222+
"DISABLE_REMOTE_GRADLE_CACHE=true"
223+
]) {
224+
def notesFiles = findFiles(glob: 'release_notes.md')
225+
if ( notesFiles.length < 1 ) {
226+
throw new IllegalStateException( "Could not locate `release_notes.md`" )
227+
}
228+
if ( notesFiles.length > 1 ) {
229+
throw new IllegalStateException( "Located more than 1 `release_notes.md`" )
230+
}
231+
232+
sh ".release/scripts/publish.sh -j --notes=${notesFiles[0].path} ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH} "
233+
}
234+
}
235+
}
236+
}
237+
}
238+
}
239+
}
240+
stage('Release on Jira') {
241+
steps {
242+
script {
243+
checkoutReleaseScripts()
244+
245+
withCredentials([string(credentialsId: 'release-webhook.hibernate.atlassian.net', variable: 'JIRA_WEBHOOK_SECRET')]) {
246+
sh ".release/scripts/jira-release.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
247+
}
248+
}
249+
}
250+
}
251+
stage('Update website') {
252+
steps {
253+
script {
254+
checkoutReleaseScripts()
236255

237-
configFileProvider([
238-
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
239-
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
240-
]) {
241-
withCredentials([
242-
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
243-
]) {
244-
sshagent( ['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net'] ) {
245-
dir( '.release/hibernate.org' ) {
256+
configFileProvider([
257+
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
258+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
259+
]) {
260+
withCredentials([
261+
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
262+
]) {
263+
sshagent( ['ed25519.Hibernate-CI.github.com'] ) {
264+
dir( '.release/hibernate.org' ) {
246265
checkout scmGit(
247266
branches: [[name: '*/production']],
248267
extensions: [],
249268
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com', url: 'https://github.com/hibernate/hibernate.org.git']]
250269
)
251270
sh "../scripts/website-release.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION}"
252-
}
253-
}
254-
}
255-
}
256-
}
257-
}
258-
}
259-
}
260-
post {
261-
always {
262-
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
263-
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
264-
}
265-
}
266-
}
271+
}
272+
}
273+
}
274+
}
275+
}
276+
}
277+
}
278+
}
279+
post {
280+
always {
281+
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
282+
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
283+
}
284+
}
285+
}
267286
}

gradle/published-java-module.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,8 @@ publishing {
164164

165165
task ciBuild( dependsOn: [test, publish] )
166166

167-
task release( dependsOn: [test] )
167+
task releasePrepare( dependsOn: [publishAllPublicationsToStagingRepository] ) {
168+
group = "Release"
169+
description = "Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one."
170+
}
168171

0 commit comments

Comments
 (0)