-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBX-2936 Adjust POMs to use gpg/nexus plugins for the release
- Loading branch information
1 parent
347f246
commit b7e408d
Showing
8 changed files
with
353 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Hibernate Tools, Tooling for your Hibernate Projects | ||
* | ||
* Copyright 2016-2024 Red Hat, Inc. | ||
* | ||
* Licensed under the GNU Lesser General Public License (LGPL), | ||
* version 2.1 or later (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* You may read the licence in the 'lgpl.txt' file in the root folder of | ||
* project or obtain a copy at | ||
* | ||
* http://www.gnu.org/licenses/lgpl-2.1.html | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" basis, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@Library('hibernate-jenkins-pipeline-helpers') _ | ||
|
||
import org.hibernate.jenkins.pipeline.helpers.version.Version | ||
|
||
pipeline { | ||
agent { | ||
label 'Worker&&Containers' | ||
} | ||
tools { | ||
maven 'Apache Maven 3.9' | ||
jdk 'OpenJDK 21 Latest' | ||
} | ||
options { | ||
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10') | ||
disableConcurrentBuilds(abortPrevious: false) | ||
} | ||
parameters { | ||
string( | ||
name: 'RELEASE_VERSION', | ||
defaultValue: '', | ||
description: 'The version to be released, e.g. 7.0.0.Final.', | ||
trim: true | ||
) | ||
string( | ||
name: 'DEVELOPMENT_VERSION', | ||
defaultValue: '', | ||
description: 'The next version to be used after the release, e.g. 7.0.1-SNAPSHOT.', | ||
trim: true | ||
) | ||
booleanParam( | ||
name: 'RELEASE_DRY_RUN', | ||
defaultValue: false, | ||
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts or documentation.' | ||
) | ||
} | ||
stages { | ||
stage('Release') { | ||
when { | ||
beforeAgent true | ||
// Releases must be triggered explicitly | ||
// This is just for safety; normally the Jenkins job for this pipeline | ||
// should be configured to "Suppress automatic SCM triggering" | ||
// See https://stackoverflow.com/questions/58259326/prevent-jenkins-multibranch-pipeline-from-triggering-builds-for-new-branches | ||
triggeredBy cause: "UserIdCause" | ||
} | ||
steps { | ||
script { | ||
// Check that all the necessary parameters are set | ||
if (!params.RELEASE_VERSION) { | ||
throw new IllegalArgumentException("Missing value for parameter RELEASE_VERSION.") | ||
} | ||
if (!params.DEVELOPMENT_VERSION) { | ||
throw new IllegalArgumentException("Missing value for parameter DEVELOPMENT_VERSION.") | ||
} | ||
|
||
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION) | ||
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION) | ||
echo "Performing full release for version ${releaseVersion.toString()}" | ||
|
||
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven', | ||
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') { | ||
configFileProvider([configFile(fileId: 'release.config.ssh', targetLocation: env.HOME + '/.ssh/config'), | ||
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) { | ||
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin) | ||
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'), | ||
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) { | ||
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) { | ||
sh 'cat $HOME/.ssh/config' | ||
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git' | ||
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg' | ||
sh """ | ||
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \ | ||
tools ${releaseVersion.toString()} ${developmentVersion.toString()} | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: 'koen@hibernate.org' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.