Skip to content

Commit

Permalink
NO_ISSUE: use release shared library (#2064)
Browse files Browse the repository at this point in the history
Co-authored-by: jstastny-cz <jan.stastny@ibm.com>
  • Loading branch information
jstastny-cz and jstastny-cz committed Jul 3, 2024
1 parent a89babe commit 33292e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
35 changes: 18 additions & 17 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,22 @@ pipeline {
.withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS ? [ env.KOGITO_APPS_BUILD_MVN_OPTS ] : [])
.skipTests(skipTests)

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()) {
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')

release.gpgImportKeyFromFileWithPassword(getReleaseGpgSignKeyCredsId(), getReleaseGpgSignPassphraseCredsId())
withCredentials([string(credentialsId: getReleaseGpgSignPassphraseCredsId(), variable: 'SIGNING_KEY_PASSWORD')]) {
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")
}
}
mavenRunClosure()
}
} else {
configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean $installOrDeploy")
}
mavenRunClosure()
}

}
}
}
Expand Down Expand Up @@ -282,3 +275,11 @@ MavenCommand getMavenCommand(String directory = '') {
.inDirectory(directory)
.withProperty('full')
}

String getReleaseGpgSignKeyCredsId() {
return env.RELEASE_GPG_SIGN_KEY_CREDS_ID
}

String getReleaseGpgSignPassphraseCredsId() {
return env.RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID
}
3 changes: 3 additions & 0 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ void setupReleaseDeployJob() {
MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}",
MAVEN_REPO_CREDS_ID: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}",

RELEASE_GPG_SIGN_KEY_CREDS_ID: Utils.getReleaseGpgSignKeyCredentialsId(this),
RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID: Utils.getReleaseGpgSignPassphraseCredentialsId(this)
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand Down

0 comments on commit 33292e5

Please sign in to comment.