You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/05/30 08:57:18 UTC

[uima-build-jenkins-shared-library] branch main updated: [UIMA-6457] Clean Jenkins workspace up after build

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

rec pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/uima-build-jenkins-shared-library.git


The following commit(s) were added to refs/heads/main by this push:
     new 6222ac7  [UIMA-6457] Clean Jenkins workspace up after build
6222ac7 is described below

commit 6222ac715aa3c25c8849637de590f86e6a20b173
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Mon May 30 10:57:13 2022 +0200

    [UIMA-6457] Clean Jenkins workspace up after build
    
    - Add wipeout parameter which is true by default
---
 vars/createConfiguration.groovy |  3 ++-
 vars/defaultPipeline.groovy     | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/vars/createConfiguration.groovy b/vars/createConfiguration.groovy
index 62cd0c0..178213c 100644
--- a/vars/createConfiguration.groovy
+++ b/vars/createConfiguration.groovy
@@ -22,7 +22,8 @@ def call(body) {
     agentLabel: '',
     maven: 'maven_latest',
     jdk: 'jdk_11_latest',
-    extraMavenArguments: ''
+    extraMavenArguments: '',
+    wipeWorkspaceAfterBuild: true
   ]
   
   body.resolveStrategy = Closure.DELEGATE_FIRST
diff --git a/vars/defaultPipeline.groovy b/vars/defaultPipeline.groovy
index 512bc12..5324df1 100644
--- a/vars/defaultPipeline.groovy
+++ b/vars/defaultPipeline.groovy
@@ -32,6 +32,10 @@ def call(body) {
         name: 'agentLabel',
         defaultValue: config.agentLabel,
         description: "Eligible agents (in case a build keeps running on a broken agent; overrides only current build)")
+      booleanParam(
+        name: 'wipeWorkspaceAfterBuild',
+        defaultValue: config.wipeWorkspaceAfterBuild,
+        description: "Wipe workspace after build (for testing; next build only)")
     }
 
     agent none
@@ -155,6 +159,20 @@ def call(body) {
               }
             }
           }
+          
+          post {
+            always {
+              script {
+                if (params.wipeWorkspaceAfterBuild) {
+                  echo "Wiping workspace..."
+                  cleanWs(cleanWhenNotBuilt: false,
+                          deleteDirs: true,
+                          disableDeferredWipeout: true,
+                          notFailBuild: true)
+                }
+              }
+            }
+          }
         }
       }
     }