This is an automated email from the ASF dual-hosted git repository.

jstastnycz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git


The following commit(s) were added to refs/heads/main by this push:
     new b73c91f06e [NO-ISSUE] Use apache-release profile when doing a release 
build (#5970)
b73c91f06e is described below

commit b73c91f06e40d1a0784c2badf9757083ef8dccd7
Author: Tibor Zimányi <[email protected]>
AuthorDate: Fri May 24 11:26:57 2024 +0200

    [NO-ISSUE] Use apache-release profile when doing a release build (#5970)
    
    * Add apache-release profile to release builds.
    
    * Add password to gpg signing setup.
    
    * Fix variable handling
    
    * Fix Maven settings use.
    
    * Add GPG passphrase to signing.
    
    * Run within withCredentials block when releasing.
---
 .ci/jenkins/Jenkinsfile.deploy | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 5fae3667d3..694df3e6d2 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -121,14 +121,35 @@ pipeline {
                         } else {
                             installOrDeploy = 'install'
                         }
-                        configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
-                            getMavenCommand()
-                                .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ 
env.DROOLS_BUILD_MVN_OPTS ] : [])
-                                .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ 
env.BUILD_MVN_OPTS_CURRENT ] : [])
-                                .withProperty('maven.test.failure.ignore', 
true)
-                                .skipTests(params.SKIP_TESTS)
-                                .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
-                                .run("clean $installOrDeploy")
+                        def mavenCommand = getMavenCommand()
+                           .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ 
env.DROOLS_BUILD_MVN_OPTS ] : [])
+                           .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ 
env.BUILD_MVN_OPTS_CURRENT ] : [])
+                           .withProperty('maven.test.failure.ignore', true)
+                           .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  
\"${WORKSPACE}\"/signkey.gpg")
+                                    sh ("rm \"${WORKSPACE}\"/signkey.gpg")
+
+                                    
mavenCommand.withProperty('gpg.passphrase', SIGNING_KEY_PASSWORD)
+                                        .withProfiles(['apache-release'])
+
+                                    // If there are passwords, this needs to 
be duplicated within the withCredentials block.
+                                    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")
+                            }
                         }
                     }
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to