Skip to content

Commit fcfd310

Browse files
committed
HBX-2969: Backport release automation to branch 5.3
Signed-off-by: Koen Aers <[email protected]>
1 parent 512ec9b commit fcfd310

File tree

7 files changed

+419
-30
lines changed

7 files changed

+419
-30
lines changed

.mvn/wrapper/maven-wrapper.jar

61.6 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=bin
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
20+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar

ci/release/Jenkinsfile

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Hibernate Tools, Tooling for your Hibernate Projects
3+
*
4+
* Copyright 2016-2024 Red Hat, Inc.
5+
*
6+
* Licensed under the GNU Lesser General Public License (LGPL),
7+
* version 2.1 or later (the "License").
8+
* You may not use this file except in compliance with the License.
9+
* You may read the licence in the 'lgpl.txt' file in the root folder of
10+
* project or obtain a copy at
11+
*
12+
* http://www.gnu.org/licenses/lgpl-2.1.html
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" basis,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
@Library('hibernate-jenkins-pipeline-helpers') _
21+
22+
import org.hibernate.jenkins.pipeline.helpers.version.Version
23+
24+
pipeline {
25+
agent {
26+
label 'Release'
27+
}
28+
tools {
29+
maven 'Apache Maven 3.9'
30+
jdk 'OpenJDK 8 Latest'
31+
}
32+
options {
33+
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10')
34+
disableConcurrentBuilds(abortPrevious: false)
35+
}
36+
parameters {
37+
string(
38+
name: 'RELEASE_VERSION',
39+
defaultValue: '',
40+
description: 'The version to be released, e.g. 5.3.37.Final.',
41+
trim: true
42+
)
43+
string(
44+
name: 'DEVELOPMENT_VERSION',
45+
defaultValue: '',
46+
description: 'The next version to be used after the release, e.g. 5.3.38-SNAPSHOT.',
47+
trim: true
48+
)
49+
booleanParam(
50+
name: 'RELEASE_DRY_RUN',
51+
defaultValue: false,
52+
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts or documentation.'
53+
)
54+
}
55+
stages {
56+
stage('Release') {
57+
when {
58+
beforeAgent true
59+
// Releases must be triggered explicitly
60+
// This is just for safety; normally the Jenkins job for this pipeline
61+
// should be configured to "Suppress automatic SCM triggering"
62+
// See https://stackoverflow.com/questions/58259326/prevent-jenkins-multibranch-pipeline-from-triggering-builds-for-new-branches
63+
triggeredBy cause: "UserIdCause"
64+
}
65+
steps {
66+
script {
67+
// Check that all the necessary parameters are set
68+
if (!params.RELEASE_VERSION) {
69+
throw new IllegalArgumentException("Missing value for parameter RELEASE_VERSION.")
70+
}
71+
if (!params.DEVELOPMENT_VERSION) {
72+
throw new IllegalArgumentException("Missing value for parameter DEVELOPMENT_VERSION.")
73+
}
74+
75+
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
76+
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
77+
echo "Performing full release for version ${releaseVersion.toString()}"
78+
79+
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
80+
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
81+
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'),
82+
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
83+
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
84+
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
85+
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
86+
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
87+
sh 'cat $HOME/.ssh/config'
88+
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git'
89+
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
90+
sh """
91+
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
92+
tools ${releaseVersion.toString()} ${developmentVersion.toString()}
93+
"""
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}
101+
}
102+
post {
103+
always {
104+
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: '[email protected]'
105+
}
106+
}
107+
}

main/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
</developer>
5656
</developers>
5757

58+
<properties>
59+
<!-- This is a publicly distributed module that should be published: -->
60+
<deploy.skip>false</deploy.skip>
61+
</properties>
62+
5863
<dependencies>
5964
<dependency>
6065
<groupId>com.google.googlejavaformat</groupId>

maven-plugin/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
</prerequisites>
5353

5454
<properties>
55-
<maven.deploy.skip>false</maven.deploy.skip>
55+
<!-- This is a publicly distributed module that should be published: -->
56+
<deploy.skip>false</deploy.skip>
5657
<maven.install.skip>false</maven.install.skip>
5758

5859
<maven-plugin-annotations.version>3.5</maven-plugin-annotations.version>

0 commit comments

Comments
 (0)