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

hboutemy pushed a commit to branch MNG-6364
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 2cf06423b562cd43256b4419169da79bf8680a06
Author: Hervé Boutemy <hbout...@apache.org>
AuthorDate: Mon May 21 14:06:14 2018 +0200

    created a function to run CoreITs and avoid copy/paste
---
 Jenkinsfile | 169 ++++++++++++++++--------------------------------------------
 1 file changed, 43 insertions(+), 126 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 6e99928..0645844 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -22,8 +22,11 @@ properties([buildDiscarder(logRotator(artifactNumToKeepStr: 
'5', numToKeepStr: e
 def buildOs = 'linux'
 def buildJdk = '8'
 def buildMvn = '3.5.0'
+def runITsOses = ['linux', 'windows']
+def runITsJdks = ['7', '8', '9']
+def runITsMvn = '3.5.0'
+def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V 
-Dmaven.test.failure.ignore=true" // -DmavenDistro=...
 def tests
-def CORE_IT_PROFILES='run-its,embedded'
 
 try {
 
@@ -59,137 +62,51 @@ node(jenkinsEnv.labelForOS(buildOs)) {
     }
 }
 
+Map runITsTasks = [:]
+for (String os in runITsOses) {
+    for (def jdk in runITsJdks) {
+        String osLabel = jenkinsEnv.labelForOS(os);
+        String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}")
+        String mvnName = jenkinsEnv.mvnFromVersion(os, "${runITsMvn}")
+        echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName}"
 
-parallel linuxJava7:{
-        node(jenkinsEnv.labelForOS('linux')) {
-            stage ('Run ITs Linux Java 7') {
-                String jdkName = jenkinsEnv.jdkFromVersion('linux', '7')
-                String mvnName = jenkinsEnv.mvnFromVersion('linux', buildMvn)
-                dir('test') {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    sh "rm -rvf $WORK_DIR/apache-maven-dist.zip 
$WORK_DIR/it-local-repo"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        sh "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
+        String stageId = "${os}-jdk${jdk}"
+        String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk}"
+        runITsTasks[stageId] = {
+            node(osLabel) {
+                stage("${stageLabel}") {
+                    // on Windows, need a short path or we hit 256 character 
limit for paths
+                    // using EXECUTOR_NUMBER guarantees that concurrent builds 
on same agent
+                    // will not trample each other
+                    dir(isUnix() ? 'test' : "/mvn-it-${EXECUTOR_NUMBER}.tmp") {
+                        def WORK_DIR=pwd()
+                        checkout tests
+                        if (isUnix()) {
+                            sh "rm -rvf $WORK_DIR/apache-maven-dist.zip 
$WORK_DIR/it-local-repo"
+                        } else {
+                            bat "if exist it-local-repo rmdir /s /q 
it-local-repo"
+                            bat "if exist apache-maven-dist.zip del /q 
apache-maven-dist.zip"
+                        }
+                        unstash 'dist'
+                        withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
+                            junitPublisher(ignoreAttachments: false)
+                        ]) {
+                            if (isUnix()) {
+                                sh "${runITscommand} 
-DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
+                            } else {
+                                bat "${runITscommand} 
-DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
+                            }
+                        }
+                        deleteDir() // clean up after ourselves to reduce disk 
space
                     }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
-                }
-            }
-        }
-    },linuxJava8: {
-        node(jenkinsEnv.labelForOS('linux')) {
-            stage ('Run ITs Linux Java 8') {
-                String jdkName = jenkinsEnv.jdkFromVersion('linux', '8')
-                String mvnName = jenkinsEnv.mvnFromVersion('linux', buildMvn)
-                dir('test') {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    sh "rm -rvf $WORK_DIR/apache-maven-dist.zip 
$WORK_DIR/it-local-repo"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        sh "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
-                    }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
-                }
-            }
-        }
-    },linuxJava9: {
-        node(jenkinsEnv.labelForOS('linux')) {
-            stage ('Linux Java 9') {
-                String jdkName = jenkinsEnv.jdkFromVersion('linux', '9')
-                String mvnName = jenkinsEnv.mvnFromVersion('linux', buildMvn)
-                dir('test') {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    sh "rm -rvf $WORK_DIR/apache-maven-dist.zip 
$WORK_DIR/it-local-repo"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        sh "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
-                    }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
-                }
-            }
-        }
-    }, winJava7: {
-        node(jenkinsEnv.labelForOS('windows')) {
-            stage ('Run ITs Windows Java 7') {
-                String jdkName = jenkinsEnv.jdkFromVersion('windows', '7')
-                String mvnName = jenkinsEnv.mvnFromVersion('windows', buildMvn)
-
-                // need a short path or we hit 256 character limit for paths
-                // using EXECUTOR_NUMBER guarantees that concurrent builds on 
same agent
-                // will not trample each other
-                dir("/mvn-it-${EXECUTOR_NUMBER}.tmp") {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    bat "if exist it-local-repo rmdir /s /q it-local-repo"
-                    bat "if exist apache-maven-dist.zip del /q 
apache-maven-dist.zip"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        bat "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
-                    }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
-                }
-            }
-        }
-    }, winJava8: {
-        node(jenkinsEnv.labelForOS('windows')) {
-            stage ('Run ITs Windows Java 8') {
-                String jdkName = jenkinsEnv.jdkFromVersion('windows', '8')
-                String mvnName = jenkinsEnv.mvnFromVersion('windows', buildMvn)
-
-                // need a short path or we hit 256 character limit for paths
-                // using EXECUTOR_NUMBER guarantees that concurrent builds on 
same agent
-                // will not trample each other
-                dir("/mvn-it-${EXECUTOR_NUMBER}.tmp") {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    bat "if exist it-local-repo rmdir /s /q it-local-repo"
-                    bat "if exist apache-maven-dist.zip del /q 
apache-maven-dist.zip"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        bat "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
-                    }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
-                }
-            }
-        }
-    }, winJava9: {
-        node(jenkinsEnv.labelForOS('windows')) {
-            stage ('Windows Java 9') {
-                String jdkName = jenkinsEnv.jdkFromVersion('windows', '9')
-                String mvnName = jenkinsEnv.mvnFromVersion('windows', buildMvn)
-
-                // need a short path or we hit 256 character limit for paths
-                // using EXECUTOR_NUMBER guarantees that concurrent builds on 
same agent
-                // will not trample each other
-                dir("/mvn-it-${EXECUTOR_NUMBER}.tmp") {
-                    def WORK_DIR=pwd()
-                    checkout tests
-                    bat "if exist it-local-repo rmdir /s /q it-local-repo"
-                    bat "if exist apache-maven-dist.zip del /q 
apache-maven-dist.zip"
-                    unstash 'dist'
-                    withMaven(jdk: jdkName, maven: mvnName, 
mavenLocalRepo:"${WORK_DIR}/it-local-repo", options:[
-                        junitPublisher(ignoreAttachments: false)
-                    ]) {
-                        bat "mvn clean install -P$CORE_IT_PROFILES -B -U -V 
-Dmaven.test.failure.ignore=true -DmavenDistro=$WORK_DIR/apache-maven-dist.zip"
-                    }
-                    deleteDir() // clean up after ourselves to reduce disk 
space
                 }
             }
         }
     }
+}
+
+// run the parallel ITs
+parallel(runITsTasks)
 
 // JENKINS-34376 seems to make it hard to detect the aborted builds
 } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {

-- 
To stop receiving notification emails like this one, please contact
hbout...@apache.org.

Reply via email to