From 9698d245fceeea9c49f12400d9dacff950441c71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 15:14:25 +0100 Subject: [PATCH] Cleanws stash is not saving .git folder --- autobuilder.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 4ad6acc..71d9b6a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -8,9 +8,14 @@ def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace - stash allowEmpty: true, includes: "${autobuildroot}/**", name: 'Clean workspace stash', useDefaultExcludes: false + def stashname = 'Clean workspace stash' + stash(allowEmpty: true, + includes: "${autobuildroot}/**,${autobuildroot}/.git/**", + name: stashname, + useDefaultExcludes: false + ) cleanWs() - unstash name: 'Clean workspace stash' + unstash name: stashname } else { echo "Not cleaning workspace"