You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/05/11 09:49:01 UTC

[maven-surefire] 01/02: [jenkinsfile] workspace cleanup before/after run

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

tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 882ae2c9a7b3631683de7c9bd41b1c5d36d57b53
Author: tibordigana <ti...@apache.org>
AuthorDate: Sun May 10 11:23:24 2020 +0200

    [jenkinsfile] workspace cleanup before/after run
---
 Jenkinsfile | 52 ++++++++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 4325c70..a887d81 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -120,6 +120,7 @@ timeout(time: 12, unit: 'HOURS') {
 }
 
 def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvnName, goals, options, mavenOpts, boolean makeReports) {
+    cleanWs()
     try {
         def mvnLocalRepoDir
         if (isUnix()) {
@@ -169,38 +170,41 @@ def buildProcess(String stageKey, String jdkName, String jdkTestName, String mvn
             }
         }
     } finally {
-        if (makeReports) {
-            openTasks(ignoreCase: true, canComputeNew: true, defaultEncoding: 'UTF-8', pattern: sourcesPatternCsv(),
-                    high: tasksViolationHigh(), normal: tasksViolationNormal(), low: tasksViolationLow())
+        try {
+            if (makeReports) {
+                openTasks(ignoreCase: true, canComputeNew: true, defaultEncoding: 'UTF-8', pattern: sourcesPatternCsv(),
+                        high: tasksViolationHigh(), normal: tasksViolationNormal(), low: tasksViolationLow())
 
-            jacoco(changeBuildStatus: false,
-                    execPattern: '**/*.exec',
-                    sourcePattern: sourcesPatternCsv(),
-                    classPattern: classPatternCsv())
+                jacoco(changeBuildStatus: false,
+                        execPattern: '**/*.exec',
+                        sourcePattern: sourcesPatternCsv(),
+                        classPattern: classPatternCsv())
 
-            junit(healthScaleFactor: 0.0,
-                    allowEmptyResults: true,
-                    keepLongStdio: true,
-                    testResults: testReportsPatternCsv())
+                junit(healthScaleFactor: 0.0,
+                        allowEmptyResults: true,
+                        keepLongStdio: true,
+                        testResults: testReportsPatternCsv())
 
-            if (currentBuild.result == 'UNSTABLE') {
-                currentBuild.result = 'FAILURE'
+                if (currentBuild.result == 'UNSTABLE') {
+                    currentBuild.result = 'FAILURE'
+                }
             }
-        }
 
-        if (currentBuild.result != null && currentBuild.result != 'SUCCESS') {
-            if (fileExists('maven-failsafe-plugin/target/it')) {
-                zip(zipFile: "maven-failsafe-plugin--${stageKey}.zip", dir: 'maven-failsafe-plugin/target/it', archive: true)
-            }
+            if (currentBuild.result != null && currentBuild.result != 'SUCCESS') {
+                if (fileExists('maven-failsafe-plugin/target/it')) {
+                    zip(zipFile: "maven-failsafe-plugin--${stageKey}.zip", dir: 'maven-failsafe-plugin/target/it', archive: true)
+                }
 
-            if (fileExists('surefire-its/target')) {
-                zip(zipFile: "surefire-its--${stageKey}.zip", dir: 'surefire-its/target', archive: true)
-            }
+                if (fileExists('surefire-its/target')) {
+                    zip(zipFile: "surefire-its--${stageKey}.zip", dir: 'surefire-its/target', archive: true)
+                }
 
-            archiveArtifacts(artifacts: "*--${stageKey}.zip", allowEmptyArchive: true, onlyIfSuccessful: false)
+                archiveArtifacts(artifacts: "*--${stageKey}.zip", allowEmptyArchive: true, onlyIfSuccessful: false)
+            }
+        } finally {
+            // clean up after ourselves to reduce disk space
+            cleanWs()
         }
-        // clean up after ourselves to reduce disk space
-        cleanWs()
     }
 }