Skip to content

Commit

Permalink
NO-ISSUE: Jenkins jobs updates and fixes for Apache 10 release (#6087)
Browse files Browse the repository at this point in the history
* NO-ISSUE: Fix release configuration keys (#6045)

* Fix release configuration keys

* Fix release configuration keys

* Rename release.groovy file to avoid conflicts with the RELEASE env var

* Switch to GPG File Jenkins secret (#6046)

* kie-issues#1397 - Adjust git tag creation for Apache 10 release (#6032)

* Adjust git tag creation for Apache 10 release

* Adjust git tag creation for Apache 10 release

* Sync main -> 10.0.x

---------

Co-authored-by: Rodrigo Antunes <[email protected]>
  • Loading branch information
rodrigonull and Rodrigo Antunes authored Oct 7, 2024
1 parent 840edd1 commit 4ca282e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
62 changes: 38 additions & 24 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ deployProperties = [:]

pipeline {
agent {
docker {
docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
label util.avoidFaultyNodes()
Expand Down Expand Up @@ -82,12 +82,12 @@ pipeline {
}
stage('Prepare for PR') {
when {
expression { return isRelease() || isCreatePr() }
expression { return isCreatePr() }
}
steps {
script {
dir(getRepoName()) {
if (githubscm.isBranchExist('origin',getPRBranch())) {
if (githubscm.isBranchExist('origin', getPRBranch())) {
githubscm.removeRemoteBranch('origin', getPRBranch(), getGitAuthorPushCredsId())
}
githubscm.createBranch(getPRBranch())
Expand All @@ -101,7 +101,7 @@ pipeline {
}
steps {
script {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
maven.mvnVersionsSet(
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
getProjectVersion(),
Expand All @@ -127,20 +127,15 @@ pipeline {
.withProperty('maven.test.failure.ignore', true)
.skipTests(params.SKIP_TESTS)

def Closure mavenRunClosure = {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
}

if (isRelease()) {
release.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
mavenCommand
.withProfiles(['apache-release'])
.withProperty('only.reproducible')
mavenRunClosure()
} else {
mavenRunClosure()
}

configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
}
}
Expand All @@ -156,7 +151,7 @@ pipeline {
}
stage('Create PR') {
when {
expression { return isRelease() || isCreatePr() }
expression { return isCreatePr() }
}
steps {
script {
Expand All @@ -180,6 +175,29 @@ pipeline {
}
}
}
stage('Commit and Create Tag') {
when {
expression { return isRelease() }
}
steps {
script {
dir(getRepoName()) {
if (githubscm.isThereAnyChanges()) {
def commitMsg = "[${getBuildBranch()}] Update version to ${getProjectVersion()}"
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg, {
githubscm.findAndStageNotIgnoredFiles('pom.xml')
githubscm.findAndStageNotIgnoredFiles('antora.yml')
})
} else {
println '[WARN] no changes to commit'
}
githubscm.tagRepository(getGitTagName())
githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId())
}
}
}
}
}
post {
always {
Expand Down Expand Up @@ -283,22 +301,18 @@ MavenCommand getMavenCommand(String directory = '') {
def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
.inDirectory(directory)
if (!isMainStream()) { // Workaround as enforcer rules may not be fixed on other streams
mvnCmd.withProperty('enforcer.skip')
} else {
mvnCmd.withProperty('full')
}
.withProperty('full')
return mvnCmd
}

boolean isMainStream() {
return env.DROOLS_STREAM == 'main'
}

String getReleaseGpgSignKeyCredsId() {
return env.RELEASE_GPG_SIGN_KEY_CREDS_ID
}

String getReleaseGpgSignPassphraseCredsId() {
return env.RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID
}

String getGitTagName() {
return params.GIT_TAG_NAME
}
2 changes: 1 addition & 1 deletion .ci/jenkins/config/branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ cloud:
release:
gpg:
sign:
key-credentials-id: 'GPG_KEY'
key-credentials-id: 'GPG_KEY_FILE'
passphrase-credentials-id: ''
jenkins:
email_creds_id: DROOLS_CI_NOTIFICATION_EMAILS
Expand Down

0 comments on commit 4ca282e

Please sign in to comment.