You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2020/07/26 19:09:39 UTC

[logging-pipelines] branch master updated: Extract toolchains to config files

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

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-pipelines.git


The following commit(s) were added to refs/heads/master by this push:
     new b145e22  Extract toolchains to config files
b145e22 is described below

commit b145e22e1227b12a4f5dd980ed74751f93af7257
Author: Matt Sicker <bo...@gmail.com>
AuthorDate: Sun Jul 26 14:08:58 2020 -0500

    Extract toolchains to config files
    
    This allows us to centralize the Jenkins toolchains files in Jenkins
    itself and avoid copying it into every branch.
---
 log4j/Jenkinsfile | 41 +++++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/log4j/Jenkinsfile b/log4j/Jenkinsfile
index d5d474d..955cc4a 100644
--- a/log4j/Jenkinsfile
+++ b/log4j/Jenkinsfile
@@ -43,13 +43,6 @@ pipeline {
         // https://cwiki.apache.org/confluence/display/INFRA/Jenkins+node+labels
         label 'ubuntu'
     }
-    // https://jenkins.io/doc/book/pipeline/syntax/#tools
-    tools {
-        // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
-        jdk 'JDK 1.8 (latest)'
-        // https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix
-        maven 'Maven 3 (latest)'
-    }
     environment {
         LANG = 'C.UTF-8'
     }
@@ -62,9 +55,7 @@ pipeline {
                     if (buildNumber > 1) milestone(buildNumber - 1)
                     milestone(buildNumber)
                 }
-                // note that the jenkins system property is set here to activate certain pom properties in
-                // some log4j modules that compile against system jars (e.g., log4j-jmx-gui)
-                sh 'mvn --show-version --toolchains toolchains-jenkins-ubuntu.xml -Djenkins clean install -DskipTests'
+                runMaven '-DskipTests clean install'
             }
         }
         stage('Test') {
@@ -72,7 +63,7 @@ pipeline {
             parallel {
                 stage('Ubuntu') {
                     steps {
-                        sh 'mvn --toolchains toolchains-jenkins-ubuntu.xml -Djenkins -Dmaven.test.failure.ignore=true verify'
+                        runMaven '-Dmaven.test.failure.ignore=true verify'
                     }
                     post {
                         always {
@@ -94,19 +85,11 @@ pipeline {
                         // https://cwiki.apache.org/confluence/display/INFRA/Jenkins+node+labels
                         label 'Windows'
                     }
-                    tools {
-                        // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
-                        jdk 'JDK 1.8 (latest)'
-                        // https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix
-                        maven 'Maven 3 (latest)'
-                    }
                     steps {
                         // note that previous test runs of log4j-mongodb* may have left behind an embedded mongo folder
                         // also note that we don't need to use the jenkins system property here as it's ubuntu-specific
-                        bat '''
-                    if exist %userprofile%\\.embedmongo\\ rd /s /q %userprofile%\\.embedmongo
-                    mvn --toolchains toolchains-jenkins-win.xml -Dmaven.test.failure.ignore=true clean install
-                    '''
+                        bat 'if exist %userprofile%\\.embedmongo\\ rd /s /q %userprofile%\\.embedmongo'
+                        runMaven '-Dmaven.test.failure.ignore=true verify'
                     }
                     post {
                         always {
@@ -126,7 +109,7 @@ pipeline {
                 }
             }
             steps {
-                sh 'mvn --toolchains toolchains-jenkins-ubuntu.xml -Djenkins deploy'
+                runMaven 'deploy'
             }
         }
     }
@@ -145,3 +128,17 @@ pipeline {
         }
     }
 }
+
+def runMaven(String args) {
+    if (isUnix()) {
+        configFileProvider([configFile(fileId: 'ubuntu', variable: 'TOOLCHAINS')]) {
+            // note that the jenkins system property is set here to activate certain pom properties in
+            // some log4j modules that compile against system jars (e.g., log4j-jmx-gui)
+            sh "./mvnw --toolchains \"\$TOOLCHAINS\" -Djenkins ${args}"
+        }
+    } else {
+        configFileProvider([configFile(fileId: 'windows', variable: 'TOOLCHAINS')]) {
+            bat ".\\mvnw.cmd --toolchains \"%TOOLCHAINS%\" ${args}"
+        }
+    }
+}