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

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


The following commit(s) were added to refs/heads/master by this push:
     new c9fec06  INFRA-16749, INFRA-16768  - Trying to keep workspace clean
c9fec06 is described below

commit c9fec06b74583dd6365e4ed70fe59f716248d800
Author: Karl Heinz Marbaise <[email protected]>
AuthorDate: Sat Jul 14 11:00:25 2018 +0200

    INFRA-16749, INFRA-16768
     - Trying to keep workspace clean
---
 vars/asfMavenTlpPlgnBuild.groovy | 104 ++++++++++++++++++++-------------------
 vars/asfMavenTlpStdBuild.groovy  |   2 +
 2 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index 6eb528c..a4a39d9 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -139,56 +139,58 @@ def doCreateTask( os, jdk, maven, tasks, first, plan, 
taskContext )
        String stageId = "${os}-jdk${jdk}-m${maven}_${plan}"
        tasks[stageId] = {
          node(label) {
-               stage("Checkout ${stageId}") {
-                 try {
-                       dir(stageId) {
-                         checkout scm
-                       }
-                 } catch (Throwable e) {
-                       if (!taskContext.failFast) {
-                         throw e
-                       } else if (taskContext.failingFast == null) {
-                         taskContext.failingFast = stageId
-                         echo "[FAIL FAST] This is the first failure and 
likely root cause"
-                         throw e
-                       } else {
-                         echo "[FAIL FAST] ${taskContext.failingFast} had 
first failure, ignoring ${e.message}"
-                       }
-                 }
-               }
-               stage("Build ${stageId}") {
-                 if (taskContext.failingFast != null) {
-                       echo "[FAIL FAST] ${taskContext.failingFast} has 
failed. Skipping ${stageId}."
-                 } else try {
-                       withMaven(jdk:jdkName, maven:mvnName, 
mavenLocalRepo:'.repository', options: [
-                         artifactsPublisher(disabled: disablePublishers),
-                         junitPublisher(ignoreAttachments: false),
-                         findbugsPublisher(disabled: disablePublishers),
-                         openTasksPublisher(disabled: disablePublishers),
-                         dependenciesFingerprintPublisher(),
-                         invokerPublisher(),
-                         pipelineGraphPublisher()
-                       ]) {
-                       dir (stageId) {
-                               if (isUnix()) {
-                                 sh cmd.join(' ')
-                               } else {
-                                 bat cmd.join(' ')
-                               }
-                         }
-                       }
-                 } catch (Throwable e) {
-                       if (!taskContext.failFast) {
-                         throw e
-                       } else if (taskContext.failingFast == null) {
-                         taskContext.failingFast = stageId
-                         echo "[FAIL FAST] This is the first failure and 
likely root cause"
-                         throw e
-                       } else {
-                         echo "[FAIL FAST] ${taskContext.failingFast} had 
first failure, ignoring ${e.message}"
-                       }
-                 }
-               }
+      stage("Checkout ${stageId}") {
+        try {
+          dir(stageId) {
+            checkout scm
+          }
+        } catch (Throwable e) {
+          if (!taskContext.failFast) {
+            throw e
+          } else if (taskContext.failingFast == null) {
+            taskContext.failingFast = stageId
+            echo "[FAIL FAST] This is the first failure and likely root cause"
+            throw e
+          } else {
+            echo "[FAIL FAST] ${taskContext.failingFast} had first failure, 
ignoring ${e.message}"
+          }
+        }
+      }
+      stage("Build ${stageId}") {
+        if (taskContext.failingFast != null) {
+          echo "[FAIL FAST] ${taskContext.failingFast} has failed. Skipping 
${stageId}."
+        } else try {
+          withMaven(jdk:jdkName, maven:mvnName, mavenLocalRepo:'.repository', 
options: [
+            artifactsPublisher(disabled: disablePublishers),
+            junitPublisher(ignoreAttachments: false),
+            findbugsPublisher(disabled: disablePublishers),
+            openTasksPublisher(disabled: disablePublishers),
+            dependenciesFingerprintPublisher(),
+            invokerPublisher(),
+            pipelineGraphPublisher()
+          ]) {
+            dir (stageId) {
+              if (isUnix()) {
+                sh cmd.join(' ')
+              } else {
+                bat cmd.join(' ')
+              }
+            }
+          }
+        } catch (Throwable e) {
+          // First step to keep the workspace clean and safe disk space
+          cleanWs()
+          if (!taskContext.failFast) {
+            throw e
+          } else if (taskContext.failingFast == null) {
+            taskContext.failingFast = stageId
+            echo "[FAIL FAST] This is the first failure and likely root cause"
+            throw e
+          } else {
+            echo "[FAIL FAST] ${taskContext.failingFast} had first failure, 
ignoring ${e.message}"
+          }
+        }
+      }
          }
        }
-}
\ No newline at end of file
+}
diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy
index fda75ce..32e26b9 100644
--- a/vars/asfMavenTlpStdBuild.groovy
+++ b/vars/asfMavenTlpStdBuild.groovy
@@ -116,6 +116,8 @@ def call(Map params = [:]) {
                   }
                 }
               } catch (Throwable e) {
+                // First step to keep the workspace clean and safe disk space
+                cleanWs()
                 if (!failFast) {
                   throw e
                 } else if (failingFast == null) {

Reply via email to