Skip to content

Commit

Permalink
[NO-ISSUE] Use apache-release profile when doing a release build (#3093)
Browse files Browse the repository at this point in the history
* Add apache-release profile to release builds.

* Add password to gpg signing setup.

* Fix Maven settings use.

* Add GPG password to Maven command.

* Run from within withCredentials block when releasing.
  • Loading branch information
baldimir committed May 24, 2024
1 parent 4e45fde commit 1c6a453
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,35 @@ pipeline {
} else {
installOrDeploy = 'install'
}
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
getOptaplannerMavenCommand()
.withProperty('maven.test.failure.ignore', true)
.withProperty('operator.image.build')
.skipTests(params.SKIP_TESTS)
.withSettingsXmlFile(MAVEN_SETTINGS_FILE)
.run("clean $installOrDeploy")

def mavenCommand = getOptaplannerMavenCommand()
.withProperty('maven.test.failure.ignore', true)
.withProperty('operator.image.build')
.skipTests(params.SKIP_TESTS)

if (isRelease()) {
withCredentials([file(credentialsId: 'asf-release-gpg-signing-key', variable: 'SIGNING_KEY')]) {
withCredentials([file(credentialsId: 'asf-release-gpg-signing-key-password', variable: 'SIGNING_KEY_PASSWORD')]) {
// copy the key to singkey.gpg file in *plain text* so we can import it
sh ('cat $SIGNING_KEY > $WORKSPACE/signkey.gpg')
// Please do not remove list keys command. When gpg is run for the first time, it may initialize some internals.
sh ('gpg --list-keys')
sh ("gpg --batch --pinentry-mode=loopback --passphrase \"${SIGNING_KEY_PASSWORD}\" --import signkey.gpg")
sh ('rm $WORKSPACE/signkey.gpg')

mavenCommand.withProperty('gpg.passphrase', SIGNING_KEY_PASSWORD)
mavenCommand.withProfiles(['apache-release'])
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
}
}
} else {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
}

}
if (isRelease()) {
updateAntoraYaml(optaplannerFolder)
Expand Down

0 comments on commit 1c6a453

Please sign in to comment.