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

tzimanyi 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 093ebe3068 kie-issues#667: fix cleanup and settingsXml handling (#5572)
093ebe3068 is described below

commit 093ebe306885049469f1a85d3d15f09e5bd1000d
Author: Jan Stastny <[email protected]>
AuthorDate: Thu Nov 2 15:25:31 2023 +0100

    kie-issues#667: fix cleanup and settingsXml handling (#5572)
    
    * kie-issues#667: fix cleanup and settingsXml handling
    
    * adjust also MavenCommands passed to maven library methods
    
    ---------
    
    Co-authored-by: jstastny-cz <[email protected]>
---
 .ci/jenkins/Jenkinsfile.deploy                     | 45 ++++++++++++++--------
 .ci/jenkins/Jenkinsfile.promote                    | 20 +++++-----
 .ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr       |  8 ++--
 .../Jenkinsfile.quarkus-3.rewrite.standalone       |  2 +-
 .ci/jenkins/Jenkinsfile.setup-branch               | 13 +++++--
 .ci/jenkins/project/Jenkinsfile.post-release       |  4 +-
 .ci/jenkins/project/Jenkinsfile.release            |  2 +
 7 files changed, 57 insertions(+), 37 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 12b11ea345..602ac06923 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -30,7 +30,7 @@ pipeline {
         stage('Initialize') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
 
                     if (params.DISPLAY_NAME) {
                         currentBuild.displayName = params.DISPLAY_NAME
@@ -83,19 +83,28 @@ pipeline {
             }
             steps {
                 script {
-                    maven.mvnVersionsSet(getMavenCommand(), 
getProjectVersion(), !isRelease())
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        maven.mvnVersionsSet(
+                            
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+                            getProjectVersion(),
+                            !isRelease()
+                        )
+                    }
                 }
             }
         }
         stage('Build & Test') {
             steps {
                 script {
-                    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)
-                        .run('clean 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 install')
+                    }
                 }
             }
             post {
@@ -165,7 +174,7 @@ pipeline {
         }
         cleanup {
             script {
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -252,7 +261,6 @@ void setDeployPropertyIfNeeded(String key, def value) {
 MavenCommand getMavenCommand(String directory = '') {
     directory = directory ?: getRepoName()
     def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
-                .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
                 .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
                 .inDirectory(directory)
     if (!isMainStream()) { // Workaround as enforcer rules may not be fixed on 
other streams
@@ -272,20 +280,25 @@ void runMavenDeploy(boolean localDeployment = false) {
         mvnCmd.withDeployRepository(env.MAVEN_DEPLOY_REPOSITORY)
     }
 
-    mvnCmd.skipTests(true)
+    configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, 
variable: 'MAVEN_SETTINGS_FILE')]){
+        mvnCmd.skipTests(true)
             .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ 
env.DROOLS_BUILD_MVN_OPTS ] : [])
             .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ 
env.BUILD_MVN_OPTS_CURRENT ] : [])
+            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
             .run('clean deploy')
+    }
 }
 
 void runMavenStage() {
-    MavenStagingHelper stagingHelper = getStagingHelper()
-    
deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID,
 getLocalDeploymentFolder()))
-    
stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID)
+    configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, 
variable: 'MAVEN_SETTINGS_FILE')]){
+        MavenStagingHelper stagingHelper = 
getStagingHelper(getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE))
+        
deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID,
 getLocalDeploymentFolder()))
+        
stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID)
+    }
 }
 
-MavenStagingHelper getStagingHelper() {
-    return new MavenStagingHelper(this, getMavenCommand())
+MavenStagingHelper getStagingHelper(MavenCommand mavenCommand) {
+    return new MavenStagingHelper(this, mavenCommand)
         .withNexusReleaseUrl(env.NEXUS_RELEASE_URL)
         .withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID)
 }
diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index 2b027750cf..661c6e1d30 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -73,13 +73,16 @@ pipeline {
             }
             steps {
                 script {
-                    getMavenCommand()
-                        .withOptions(env.DROOLS_BUILD_MVN_OPTS ? [ 
env.DROOLS_BUILD_MVN_OPTS ] : [])
-                        .withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ 
env.BUILD_MVN_OPTS_CURRENT ] : [])
-                        .inDirectory(getRepoName())
-                        .skipTests(true)
-                        .withProperty('full')
-                        .run('clean 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 ] : [])
+                            .inDirectory(getRepoName())
+                            .skipTests(true)
+                            .withProperty('full')
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                    }
                     uploadFileMgmt(getRepoName())
                 }
             }
@@ -91,7 +94,7 @@ pipeline {
         }
         cleanup {
             script {
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -198,7 +201,6 @@ void tagLatest() {
 
 MavenCommand getMavenCommand() {
     mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
-                    .withSettingsXmlId("${env.MAVEN_SETTINGS_CONFIG_FILE_ID}")
                     .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : 
[])
     if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
         mvnCmd.withDependencyRepositoryInSettings('deps-repo', 
env.MAVEN_DEPENDENCIES_REPOSITORY)
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr 
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
index 5a4b689871..b034906a55 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
@@ -20,7 +20,7 @@ pipeline {
         stage('Initialization') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
 
                     sh 'printenv > env_props'
                     archiveArtifacts artifacts: 'env_props'
@@ -58,10 +58,8 @@ pipeline {
         }
     }
     post {
-        always {
-            script {
-                cleanWs()
-            }
+        cleanup {
+            cleanWs()
         }
         unsuccessful {
             script {
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone 
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
index 4e2c7cf7ee..03d3f07cc3 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
@@ -107,7 +107,7 @@ pipeline {
 
 void clean() {
     sh 'rm -rf ~/.rewrite-cache/'
-    util.cleanNode('docker')
+    util.cleanNode()
 }
 
 void sendErrorNotification() {
diff --git a/.ci/jenkins/Jenkinsfile.setup-branch 
b/.ci/jenkins/Jenkinsfile.setup-branch
index 95b74cfcbe..b8502466ea 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -26,7 +26,7 @@ pipeline {
         stage('Initialize') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
 
                     if (params.DISPLAY_NAME) {
                         currentBuild.displayName = params.DISPLAY_NAME
@@ -41,7 +41,13 @@ pipeline {
             steps {
                 script {
                     dir(getRepoName()) {
-                        maven.mvnVersionsSet(getMavenCommand(), 
getDroolsVersion(), true)
+                        configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                            maven.mvnVersionsSet(
+                                
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+                                getDroolsVersion(),
+                                true
+                            )
+                        }
                     }
                 }
             }
@@ -82,7 +88,7 @@ pipeline {
         }
         cleanup {
             script {
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -125,7 +131,6 @@ String getGitAuthorCredsId() {
 
 MavenCommand getMavenCommand() {
     return new MavenCommand(this, ['-fae', '-ntp'])
-                .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
                 .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
                 .withProperty('full')
 }
diff --git a/.ci/jenkins/project/Jenkinsfile.post-release 
b/.ci/jenkins/project/Jenkinsfile.post-release
index a23c2cff2e..bbe70e1c23 100644
--- a/.ci/jenkins/project/Jenkinsfile.post-release
+++ b/.ci/jenkins/project/Jenkinsfile.post-release
@@ -29,7 +29,7 @@ pipeline {
         stage('Initialization') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
                 }
             }
         }
@@ -58,7 +58,7 @@ pipeline {
         }
     }
     post {
-        always {
+        cleanup {
             cleanWs()
         }
         unsuccessful {
diff --git a/.ci/jenkins/project/Jenkinsfile.release 
b/.ci/jenkins/project/Jenkinsfile.release
index 65943d551a..726b95ce9c 100644
--- a/.ci/jenkins/project/Jenkinsfile.release
+++ b/.ci/jenkins/project/Jenkinsfile.release
@@ -149,6 +149,8 @@ pipeline {
             script {
                 saveReleaseProperties()
             }
+        }
+        cleanup {
             cleanWs()
         }
         success {


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

Reply via email to