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-optaplanner.git


The following commit(s) were added to refs/heads/main by this push:
     new 580520abe0 kie-issues#667: fix cleanup and settingsXml handling (#3010)
580520abe0 is described below

commit 580520abe0162fb85cfe2f15e9670a041ad26b74
Author: Jan Stastny <[email protected]>
AuthorDate: Fri Nov 3 16:12:04 2023 +0100

    kie-issues#667: fix cleanup and settingsXml handling (#3010)
    
    * 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.promote              | 18 ++++++++-------
 .ci/jenkins/Jenkinsfile.setup-branch         | 11 ++++++---
 .ci/jenkins/Jenkinsfile.turtle               |  8 ++++---
 .ci/jenkins/dsl/jobs.groovy                  |  4 +++-
 .ci/jenkins/project/Jenkinsfile.drools       | 34 +++++++++++++++++-----------
 .ci/jenkins/project/Jenkinsfile.post-release | 22 +++++++++++++-----
 .ci/jenkins/project/Jenkinsfile.release      |  2 ++
 7 files changed, 65 insertions(+), 34 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index 341460b3e4..50a453a22e 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -35,7 +35,7 @@ pipeline {
         stage('Initialization') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
 
                     if (params.DISPLAY_NAME) {
                         currentBuild.displayName = params.DISPLAY_NAME
@@ -92,11 +92,14 @@ pipeline {
         stage('Upload OptaPlanner documentation') {
             steps {
                 script {
-                    getMavenCommand()
-                            .inDirectory(optaplannerRepository)
-                            .skipTests(true)
-                            .withProperty('full')
-                            .run('clean install')
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        getMavenCommand()
+                                .inDirectory(optaplannerRepository)
+                                .skipTests(true)
+                                .withProperty('full')
+                                .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                                .run('clean install')
+                    }
                     uploadDistribution(optaplannerRepository)
                 }
             }
@@ -118,7 +121,7 @@ pipeline {
         cleanup {
             script {
                 // Clean also docker in case of usage of testcontainers lib
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -246,7 +249,6 @@ void uploadDistribution(String directory) {
 
 MavenCommand getMavenCommand() {
     mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
-                    .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
     if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
         mvnCmd.withDependencyRepositoryInSettings('deps-repo', 
env.MAVEN_DEPENDENCIES_REPOSITORY)
     }
diff --git a/.ci/jenkins/Jenkinsfile.setup-branch 
b/.ci/jenkins/Jenkinsfile.setup-branch
index 196f687fbc..ee38758da7 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -41,7 +41,13 @@ pipeline {
             steps {
                 script {
                     dir(getRepoName()) {
-                        maven.mvnVersionsSet(getMavenCommand(), 
getOptaPlannerVersion(), true)
+                        configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                            maven.mvnVersionsSet(
+                                
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
+                                getOptaPlannerVersion(),
+                                true
+                            )
+                        }
                     }
                 }
             }
@@ -84,7 +90,7 @@ pipeline {
         }
         cleanup {
             script {
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -128,7 +134,6 @@ String getGitAuthorCredsId() {
 
 MavenCommand getMavenCommand() {
     return new MavenCommand(this, ['-fae', '-ntp'])
-                .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
                 .withProperty('full')
 }
 
diff --git a/.ci/jenkins/Jenkinsfile.turtle b/.ci/jenkins/Jenkinsfile.turtle
index 2130facecb..97f8bc6c3c 100644
--- a/.ci/jenkins/Jenkinsfile.turtle
+++ b/.ci/jenkins/Jenkinsfile.turtle
@@ -31,16 +31,18 @@ pipeline {
         stage('Build OptaPlanner with turtle tests') {
             steps {
                 script {
-                    new MavenCommand(this)
-                            // Use the same settings.xml as for the nightly 
builds, including a maven mirror.
-                            .withSettingsXmlId('kie-release-settings')
+                    // Use the same settings.xml as for the nightly builds, 
including a maven mirror.
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        new MavenCommand(this)
                             .inDirectory(optaplannerRepo)
                             .withOptions(['-U', '-e', '-fae', '-ntp'])
                             .withProperty('full')
                             .withProperty('runTurtleTests', true)
                             .withProperty('maven.test.failure.ignore', true)
                             .withProperty('constraintStreamImplType', 
getConstraintStreamImplType())
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
                             .run('clean install')
+                    }
                 }
             }
         }
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index c8ebbe46c0..3b45901ab1 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -72,6 +72,7 @@ void setupProjectDroolsJob(String droolsBranch) {
         JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
         NOTIFICATION_JOB_NAME: 'Drools snapshot check',
         DROOLS_BRANCH: droolsBranch,
+        MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
     ])
     KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
         parameters {
@@ -403,7 +404,8 @@ void setupOptaPlannerTurtleTestsJob(String 
constraintStreamImplType) {
     JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this, 
jobParams)
     jobParams.env.putAll([
             CONSTRAINT_STREAM_IMPL_TYPE: "${constraintStreamImplType}",
-            JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}"
+            JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
+            MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
     ])
     jobParams.triggers = [ cron : 'H H * * 5' ] // Run every Friday.
     KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
diff --git a/.ci/jenkins/project/Jenkinsfile.drools 
b/.ci/jenkins/project/Jenkinsfile.drools
index 6c6c1d7471..6ecc2e3d80 100644
--- a/.ci/jenkins/project/Jenkinsfile.drools
+++ b/.ci/jenkins/project/Jenkinsfile.drools
@@ -34,9 +34,12 @@ pipeline {
         stage('Build drools') {
             steps {
                 script {
-                    getMavenCommand(droolsRepo)
-                        .withProperty('quickly')
-                        .run('clean install')
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        getMavenCommand(droolsRepo)
+                            .withProperty('quickly')
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                    }
                 }
             }
             post {
@@ -67,10 +70,13 @@ pipeline {
         stage('Build optaplanner') {
             steps {
                 script {
-                    getMavenCommand(optaplannerRepo)
-                        .withProperty('maven.test.failure.ignore', true)
-                        .withProperty('version.org.drools', env.DROOLS_VERSION)
-                        .run('clean install')
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        getMavenCommand(optaplannerRepo)
+                            .withProperty('maven.test.failure.ignore', true)
+                            .withProperty('version.org.drools', 
env.DROOLS_VERSION)
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                    }
                 }
             }
             post {
@@ -87,10 +93,13 @@ pipeline {
         stage('Build optaplanner-quickstarts') {
             steps {
                 script {
-                    getMavenCommand(quickstartsRepo)
-                        .withProperty('maven.test.failure.ignore', true)
-                        .withProperty('version.org.drools', env.DROOLS_VERSION)
-                        .run('clean install')
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        getMavenCommand(quickstartsRepo)
+                            .withProperty('maven.test.failure.ignore', true)
+                            .withProperty('version.org.drools', 
env.DROOLS_VERSION)
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                    }
                 }
             }
             post {
@@ -108,7 +117,7 @@ pipeline {
         }
         cleanup {
             script {
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -146,7 +155,6 @@ void checkoutDroolsRepo() {
 
 MavenCommand getMavenCommand(String directory) {
     def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
-                .withSettingsXmlId('kie-release-settings')
                 .inDirectory(directory)
     if (env.BUILD_MVN_OPTS) {
         mvnCmd.withOptions([ env.BUILD_MVN_OPTS ])
diff --git a/.ci/jenkins/project/Jenkinsfile.post-release 
b/.ci/jenkins/project/Jenkinsfile.post-release
index 4a4bfb8c21..9163b57b86 100644
--- a/.ci/jenkins/project/Jenkinsfile.post-release
+++ b/.ci/jenkins/project/Jenkinsfile.post-release
@@ -32,7 +32,7 @@ pipeline {
         stage('Initialization') {
             steps {
                 script {
-                    cleanWs()
+                    cleanWs(disableDeferredWipeout: true)
 
                     if (params.DISPLAY_NAME) {
                         currentBuild.displayName = params.DISPLAY_NAME
@@ -75,8 +75,20 @@ pipeline {
         stage('Upload OptaPlanner distribution from Quickstarts') {
             steps {
                 script {
-                    
getMavenCommand().inDirectory(optaplannerRepository).withProperty('quickly').withProperty('full').run('clean
 install')
-                    
getMavenCommand().inDirectory(quickstartsRepository).skipTests(true).withProperty('full').run('clean
 install')
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                        getMavenCommand()
+                            .inDirectory(optaplannerRepository)
+                            .withProperty('quickly')
+                            .withProperty('full')
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                        getMavenCommand()
+                            .inDirectory(quickstartsRepository)
+                            .skipTests(true)
+                            .withProperty('full')
+                            .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                            .run('clean install')
+                    }
                     uploadDistribution(quickstartsRepository)
                 }
             }
@@ -124,8 +136,7 @@ pipeline {
         }
         cleanup {
             script {
-                // Clean also docker in case of usage of testcontainers lib
-                util.cleanNode('docker')
+                util.cleanNode()
             }
         }
     }
@@ -240,7 +251,6 @@ void uploadDistribution(String directory) {
 
 MavenCommand getMavenCommand() {
     mvnCmd = new MavenCommand(this, ['-fae'])
-                    .withSettingsXmlId(env.MAVEN_SETTINGS_CONFIG_FILE_ID)
     if (env.MAVEN_DEPENDENCIES_REPOSITORY) {
         mvnCmd.withDependencyRepositoryInSettings('deps-repo', 
env.MAVEN_DEPENDENCIES_REPOSITORY)
     }
diff --git a/.ci/jenkins/project/Jenkinsfile.release 
b/.ci/jenkins/project/Jenkinsfile.release
index 50b036cb0a..784c2b8514 100644
--- a/.ci/jenkins/project/Jenkinsfile.release
+++ b/.ci/jenkins/project/Jenkinsfile.release
@@ -127,6 +127,8 @@ pipeline {
             script {
                 saveReleaseProperties()
             }
+        }
+        cleanup {
             cleanWs()
         }
         success {


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

Reply via email to