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

rec pushed a commit to branch 
UIMA-6451-Jenkins-builds-should-run-against-multiple-platforms
in repository 
https://gitbox.apache.org/repos/asf/uima-build-jenkins-shared-library.git

commit 58c9fc1c3706c5f5f885aaf374d896a81206f55a
Author: Richard Eckart de Castilho <[email protected]>
AuthorDate: Thu May 12 12:48:40 2022 +0200

    [UIMA-6451] Jenkins builds should run against multiple platforms
    
    - Added a matrix wrapper with two platforms, Windows and ubuntu - only 
deploy the SNAPSHOTs build from ubuntu
---
 vars/defaultPipeline.groovy | 147 ++++++++++++++++++++++++--------------------
 1 file changed, 80 insertions(+), 67 deletions(-)

diff --git a/vars/defaultPipeline.groovy b/vars/defaultPipeline.groovy
index 68a7f21..7f5f069 100644
--- a/vars/defaultPipeline.groovy
+++ b/vars/defaultPipeline.groovy
@@ -32,9 +32,7 @@ def call(body) {
         description: "Eligible agents (in case a build keeps running on a 
broken agent; overrides only current build)")
     }
 
-    agent {
-      label params.agentLabel ?: config.agentLabel
-    }
+    agent none
   
     tools {
       maven config.maven
@@ -52,86 +50,101 @@ def call(body) {
     }
       
     stages {
-      // Display information about the build environemnt. This can be useful 
for debugging
-      // build issues.
-      stage("Build info") {
-        steps {
-          echo '=== Environment variables ==='
-          script {
-            if (isUnix()) {
-              sh 'printenv'
-            }
-            else {
-              bat 'set'
-            }
+      matrix {
+        axes {
+          axis {
+              name 'PLATFORM'
+              values 'ubuntu', 'Windows'
           }
         }
-      }
-          
-      // Perform a merge request build. This is a conditional stage executed 
with the GitLab
-      // sources plugin triggers a build for a merge request. To avoid 
conflicts with other
-      // builds, this stage should not deploy artifacts to the Maven 
repository server and
-      // also not install them locally.
-      stage("Pull request build") {
-        when { branch 'PR-*' }
-      
-        steps {
-          script {
-            currentBuild.description = 'Triggered by: <a href="' + CHANGE_URL 
+ '">' + BRANCH_NAME +
-              ': ' + env.CHANGE_BRANCH + '</a> (' +  
env.CHANGE_AUTHOR_DISPLAY_NAME + ')'
-          }
-  
-          withMaven(maven: config.maven, jdk: config.jdk) {
+
+        agent {
+          label params.agentLabel ?: "(" + config.agentLabel + ") && 
${PLATFORM}"
+        }
+         
+        // Display information about the build environemnt. This can be useful 
for debugging
+        // build issues.
+        stage("Build info") {
+          steps {
+            echo '=== Environment variables ==='
             script {
-              def mavenCommand = 'mvn ' +
-                  params.extraMavenArguments +
-                  ' -U -Dmaven.test.failure.ignore=true clean verify';
-                  
               if (isUnix()) {
-                sh script: mavenCommand
+                sh 'printenv'
               }
               else {
-                bat script: mavenCommand
+                bat 'set'
               }
             }
           }
-          
-          script {
-            def mavenConsoleIssues = scanForIssues tool: mavenConsole()
-            def javaIssues = scanForIssues tool: java()
-            def javaDocIssues = scanForIssues tool: javaDoc()
-            publishIssues issues: [mavenConsoleIssues, javaIssues, 
javaDocIssues]
-          }
         }
-      }
-      
-      // Perform a SNAPSHOT build of a main branch. This stage is typically 
executed after a
-      // merge request has been merged. On success, it deploys the generated 
artifacts to the
-      // Maven repository server.
-      stage("SNAPSHOT build") {
-        when { branch pattern: "main|main-v2", comparator: "REGEXP" }
+            
+        // Perform a merge request build. This is a conditional stage executed 
with the GitLab
+        // sources plugin triggers a build for a merge request. To avoid 
conflicts with other
+        // builds, this stage should not deploy artifacts to the Maven 
repository server and
+        // also not install them locally.
+        stage("Pull request build") {
+          when { branch 'PR-*' }
         
-        steps {
-          withMaven(maven: config.maven, jdk: config.jdk) {
+          steps {
             script {
-              def mavenCommand = 'mvn ' +
-                params.extraMavenArguments +
-                ' -U -Dmaven.test.failure.ignore=true clean deploy'
-                
-              if (isUnix()) {
-                sh script: mavenCommand
-              }
-              else {
-                bat script: mavenCommand
+              currentBuild.description = 'Triggered by: <a href="' + 
CHANGE_URL + '">' + BRANCH_NAME +
+                ': ' + env.CHANGE_BRANCH + '</a> (' +  
env.CHANGE_AUTHOR_DISPLAY_NAME + ')'
+            }
+    
+            withMaven(maven: config.maven, jdk: config.jdk) {
+              script {
+                def mavenCommand = 'mvn ' +
+                    params.extraMavenArguments +
+                    ' -U -Dmaven.test.failure.ignore=true clean verify';
+                    
+                if (isUnix()) {
+                  sh script: mavenCommand
+                }
+                else {
+                  bat script: mavenCommand
+                }
               }
             }
+            
+            script {
+              def mavenConsoleIssues = scanForIssues tool: mavenConsole()
+              def javaIssues = scanForIssues tool: java()
+              def javaDocIssues = scanForIssues tool: javaDoc()
+              publishIssues issues: [mavenConsoleIssues, javaIssues, 
javaDocIssues]
+            }
           }
+        }
+        
+        // Perform a SNAPSHOT build of a main branch. This stage is typically 
executed after a
+        // merge request has been merged. On success, it deploys the generated 
artifacts to the
+        // Maven repository server.
+        stage("SNAPSHOT build") {
+          when { branch pattern: "main|main-v2", comparator: "REGEXP" }
           
-          script {
-            def mavenConsoleIssues = scanForIssues tool: mavenConsole()
-            def javaIssues = scanForIssues tool: java()
-            def javaDocIssues = scanForIssues tool: javaDoc()
-            publishIssues issues: [mavenConsoleIssues, javaIssues, 
javaDocIssues]
+          steps {
+            withMaven(maven: config.maven, jdk: config.jdk) {
+              script {
+                def finalStep = PLATFORM == "ubuntu" ? "deploy" : "verify"
+                
+                def mavenCommand = 'mvn ' +
+                  params.extraMavenArguments +
+                  ' -U -Dmaven.test.failure.ignore=true clean deploy'
+                  
+                if (isUnix()) {
+                  sh script: mavenCommand
+                }
+                else {
+                  bat script: mavenCommand
+                }
+              }
+            }
+            
+            script {
+              def mavenConsoleIssues = scanForIssues tool: mavenConsole()
+              def javaIssues = scanForIssues tool: java()
+              def javaDocIssues = scanForIssues tool: javaDoc()
+              publishIssues issues: [mavenConsoleIssues, javaIssues, 
javaDocIssues]
+            }
           }
         }
       }

Reply via email to