You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2020/02/10 07:22:24 UTC

[struts] branch master updated: Uses multiple stages to build on different JDKs

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

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/master by this push:
     new 60e9faf  Uses multiple stages to build on different JDKs
60e9faf is described below

commit 60e9faf4dc1405cb97c44d6da7f5a7076beefa58
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Mon Feb 10 08:22:17 2020 +0100

    Uses multiple stages to build on different JDKs
---
 Jenkinsfile | 145 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 42 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 0c2f6e5..17f642f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,13 +1,6 @@
 #!groovy
 pipeline {
-  agent {
-    docker {
-      label 'ubuntu'
-      image 'maven:3-jdk-8'
-      args '-v $HOME/.m2:/root/.m2 -e MAVEN_OPTS="-Xmx1024m" -e USER=$USER'
-      reuseNode true
-    }
-  }
+  agent none
   options {
     buildDiscarder logRotator(daysToKeepStr: '14', numToKeepStr: '10')
     timeout(80)
@@ -18,51 +11,119 @@ pipeline {
     pollSCM 'H/15 * * * *'
   }
   stages {
-    stage('Build') {
-      steps {
-        sh 'mvn -B clean package -DskipTests -DskipAssembly'
+    stage('JDK 11') {
+      agent {
+        docker {
+          label 'ubuntu'
+          image 'maven:3-jdk-11'
+          args '-v $HOME/.m2:/root/.m2 -e MAVEN_OPTS="-Xmx1024m" -e USER=$USER'
+          reuseNode true
+        }
+        stages {
+          stage('Build') {
+            steps {
+              sh 'mvn -B clean package -DskipTests -DskipAssembly'
+            }
+          }
+          stage('Test') {
+            steps {
+              sh 'mvn -B test'
+              step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
+            }
+            post {
+              always {
+                junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
+                junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
+              }
+            }
+          }
+        }
       }
     }
-    stage('Test') {
-      steps {
-        sh 'mvn -B test'
-        step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
-      }
-      post {
-        always {
-          junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
-          junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
+    stage('JDK 9') {
+      agent {
+        docker {
+          label 'ubuntu'
+          image 'maven:3-jdk-9'
+          args '-v $HOME/.m2:/root/.m2 -e MAVEN_OPTS="-Xmx1024m" -e USER=$USER'
+          reuseNode true
+        }
+        stages {
+          stage('Build') {
+            steps {
+              sh 'mvn -B clean package -DskipTests -DskipAssembly'
+            }
+          }
+          stage('Test') {
+            steps {
+              sh 'mvn -B test'
+              step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
+            }
+            post {
+              always {
+                junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
+                junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
+              }
+            }
+          }
         }
       }
     }
-    stage('Build Source & JavaDoc') {
-      when {
-        branch 'master'
+    stage('JDK 8') {
+      agent {
+        docker {
+          label 'ubuntu'
+          image 'maven:3-jdk-8'
+          args '-v $HOME/.m2:/root/.m2 -e MAVEN_OPTS="-Xmx1024m" -e USER=$USER'
+          reuseNode true
+        }
       }
-      steps {
-        dir("local-snapshots-dir/") {
-          deleteDir()
+      stage('Build') {
+        steps {
+          sh 'mvn -B clean package -DskipTests -DskipAssembly'
         }
-        sh 'mvn -B source:jar javadoc:jar -DskipAssembbly'
       }
-    }
-    stage('Deploy Snapshot') {
-      when {
-        branch 'master'
+      stage('Test') {
+        steps {
+          sh 'mvn -B test'
+          step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
+        }
+        post {
+          always {
+            junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true)
+            junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true)
+          }
+        }
       }
-      steps {
-        withCredentials([file(credentialsId: 'struts-custom-settings_xml', variable: 'CUSTOM_SETTINGS')]) {
-          sh 'mvn -s \${CUSTOM_SETTINGS} deploy -skipAssembly'
+      stage('Build Source & JavaDoc') {
+        when {
+          branch 'master'
+        }
+        steps {
+          dir("local-snapshots-dir/") {
+            deleteDir()
+          }
+          sh 'mvn -B source:jar javadoc:jar -DskipAssembbly'
         }
       }
-    }
-    stage('Code Quality') {
-      when {
-        branch 'master'
+      stage('Deploy Snapshot') {
+        when {
+          branch 'master'
+        }
+        steps {
+          withCredentials([file(credentialsId: 'struts-custom-settings_xml', variable: 'CUSTOM_SETTINGS')]) {
+            sh 'mvn -s \${CUSTOM_SETTINGS} deploy -skipAssembly'
+          }
+        }
       }
-      steps {
-        withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
-          sh 'mvn sonar:sonar -DskipAssembly -Dsonar.projectKey=apache_struts -Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONARCLOUD_TOKEN}'
+      stage('Code Quality') {
+        when {
+          branch 'master'
+        }
+        steps {
+          withCredentials([string(credentialsId: 'asf-struts-sonarcloud', variable: 'SONARCLOUD_TOKEN')]) {
+            sh 'mvn sonar:sonar -DskipAssembly -Dsonar.projectKey=apache_struts -Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONARCLOUD_TOKEN}'
+          }
         }
       }
     }
@@ -116,4 +177,4 @@ pipeline {
       }
     }
   }
-}
+}
\ No newline at end of file