-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove release from GitHub #1980
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e3a62de
[#1956] Remove release jobs from the GitHub workflow
DavideD aebd96d
[#1956] Add .release to .gitignore
DavideD d7f4552
[#1956] Remove nu.credentials plugin and JBoss Nexus repository
DavideD baecfeb
[#1956] Update Gradle release tasks and remove warnings
DavideD 4a7c515
[#1956] Add Jenkins release pipeline configuration
DavideD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -43,3 +43,6 @@ bin | |
# Vim | ||
*.swp | ||
*.swo | ||
|
||
# Release scripts downloaded from hibernate/hibernate-release-scripts | ||
.release |
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,191 @@ | ||
#! /usr/bin/groovy | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
|
||
/* | ||
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers | ||
*/ | ||
@Library('hibernate-jenkins-pipeline-helpers@1.17') _ | ||
|
||
import org.hibernate.jenkins.pipeline.helpers.version.Version | ||
|
||
// -------------------------------------------- | ||
// Global build configuration | ||
env.PROJECT = "reactive" | ||
env.JIRA_KEY = "HREACT" | ||
def RELEASE_ON_PUSH = false // Set to `true` *only* on branches where you want a release on each push. | ||
|
||
print "INFO: env.PROJECT = ${env.PROJECT}" | ||
print "INFO: env.JIRA_KEY = ${env.JIRA_KEY}" | ||
print "INFO: RELEASE_ON_PUSH = ${RELEASE_ON_PUSH}" | ||
|
||
// -------------------------------------------- | ||
// Build conditions | ||
|
||
// Avoid running the pipeline on branch indexing | ||
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { | ||
print "INFO: Build skipped due to trigger being Branch Indexing" | ||
currentBuild.result = 'NOT_BUILT' | ||
return | ||
} | ||
|
||
def manualRelease = currentBuild.getBuildCauses().toString().contains( 'UserIdCause' ) | ||
|
||
// Only do automatic release on branches where we opted in | ||
if ( !manualRelease && !RELEASE_ON_PUSH ) { | ||
print "INFO: Build skipped because automated releases are disabled on this branch. See constant RELEASE_ON_PUSH in ci/release/Jenkinsfile" | ||
currentBuild.result = 'NOT_BUILT' | ||
return | ||
} | ||
|
||
// -------------------------------------------- | ||
// Reusable methods | ||
|
||
def checkoutReleaseScripts() { | ||
dir('.release/scripts') { | ||
checkout scmGit(branches: [[name: '*/main']], extensions: [], | ||
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com', | ||
url: 'https://github.com/hibernate/hibernate-release-scripts.git']]) | ||
} | ||
} | ||
|
||
// -------------------------------------------- | ||
// Pipeline | ||
|
||
pipeline { | ||
agent { | ||
label 'Worker&&Containers' | ||
} | ||
tools { | ||
jdk 'OpenJDK 11 Latest' | ||
} | ||
options { | ||
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '10') | ||
rateLimitBuilds(throttle: [count: 1, durationName: 'day', userBoost: true]) | ||
disableConcurrentBuilds(abortPrevious: false) | ||
preserveStashes() | ||
} | ||
parameters { | ||
string( | ||
name: 'RELEASE_VERSION', | ||
defaultValue: '', | ||
description: 'The version to be released, e.g. 2.4.0.Final. Mandatory for manual releases, to prevent mistakes.', | ||
trim: true | ||
) | ||
string( | ||
name: 'DEVELOPMENT_VERSION', | ||
defaultValue: '', | ||
description: 'The next version to be used after the release, e.g. 2.4.1-SNAPSHOT. If not set, determined automatically from the release version.', | ||
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 check') { | ||
steps { | ||
script { | ||
checkoutReleaseScripts() | ||
|
||
def currentVersion = Version.parseDevelopmentVersion( sh( | ||
script: ".release/scripts/determine-current-version.sh ${env.PROJECT}", | ||
returnStdout: true | ||
).trim() ) | ||
echo "Workspace version: ${currentVersion}" | ||
|
||
def releaseVersion | ||
def developmentVersion | ||
|
||
if ( manualRelease ) { | ||
echo "Release was requested manually" | ||
|
||
if ( !params.RELEASE_VERSION ) { | ||
throw new IllegalArgumentException( 'Missing value for parameter RELEASE_VERSION. This parameter must be set explicitly to prevent mistakes.' ) | ||
} | ||
releaseVersion = Version.parseReleaseVersion( params.RELEASE_VERSION ) | ||
|
||
if ( !releaseVersion.toString().startsWith( currentVersion.family + '.' ) ) { | ||
throw new IllegalArgumentException( "RELEASE_VERSION = $releaseVersion, which is different from the family of CURRENT_VERSION = $currentVersion. Did you make a mistake?" ) | ||
} | ||
} | ||
else { | ||
echo "Release was triggered automatically" | ||
|
||
// Avoid doing an automatic release for commits from a release | ||
def lastCommitter = sh(script: 'git show -s --format=\'%an\'', returnStdout: true) | ||
def secondLastCommitter = sh(script: 'git show -s --format=\'%an\' HEAD~1', returnStdout: true) | ||
if (lastCommitter == 'Hibernate-CI' && secondLastCommitter == 'Hibernate-CI') { | ||
print "INFO: Automatic release skipped because last commits were for the previous release" | ||
currentBuild.result = 'ABORTED' | ||
return | ||
} | ||
|
||
releaseVersion = Version.parseReleaseVersion( sh( | ||
script: ".release/scripts/determine-release-version.sh ${currentVersion}", | ||
returnStdout: true | ||
).trim() ) | ||
} | ||
echo "Release version: ${releaseVersion}" | ||
|
||
if ( !params.DEVELOPMENT_VERSION ) { | ||
developmentVersion = Version.parseDevelopmentVersion( sh( | ||
script: ".release/scripts/determine-development-version.sh ${releaseVersion}", | ||
returnStdout: true | ||
).trim() ) | ||
} | ||
else { | ||
developmentVersion = Version.parseDevelopmentVersion( params.DEVELOPMENT_VERSION ) | ||
} | ||
echo "Development version: ${developmentVersion}" | ||
|
||
env.RELEASE_VERSION = releaseVersion.toString() | ||
env.DEVELOPMENT_VERSION = developmentVersion.toString() | ||
// Dry run is not supported at the moment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean to add this in a later PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, this is just a leftover. Dry run is working |
||
env.SCRIPT_OPTIONS = params.RELEASE_DRY_RUN ? "-d" : "" | ||
|
||
// Determine version id to check if Jira version exists | ||
// This step doesn't work for Hibernate Reactive (the project has been created with a different type on JIRA) | ||
// sh ".release/scripts/determine-jira-version-id.sh ${env.JIRA_KEY} ${releaseVersion.withoutFinalQualifier}" | ||
} | ||
} | ||
} | ||
stage('Publish release') { | ||
steps { | ||
script { | ||
checkoutReleaseScripts() | ||
|
||
configFileProvider([ | ||
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"), | ||
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts") | ||
]) { | ||
withCredentials([ | ||
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'), | ||
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'), | ||
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'), | ||
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE'), | ||
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default') | ||
]) { | ||
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) { | ||
// performs documentation upload and Sonatype release | ||
// push to github | ||
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: 'davide@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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan to restore snapshot publishing somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm working on it now.