move cleanup to finally
generated model would never been deleted if it fails once.
Change-Id: I138e5693ddccedd286cc57416256f05cb1d2b1c9
diff --git a/generate-cookiecutter-products.groovy b/generate-cookiecutter-products.groovy
index 3dc2d8c..3074d21 100644
--- a/generate-cookiecutter-products.groovy
+++ b/generate-cookiecutter-products.groovy
@@ -129,16 +129,15 @@
git.pushGitChanges(modelEnv, targetBranch, 'origin', RECLASS_MODEL_CREDENTIALS)
}
- stage ('Clean workspace directories') {
- sh(returnStdout: true, script: "rm ${templateEnv} -rf")
- sh(returnStdout: true, script: "rm ${modelEnv} -rf")
- }
-
} catch (Throwable e) {
// If there was an error or exception thrown, the build failed
currentBuild.result = "FAILURE"
throw e
} finally {
+ stage ('Clean workspace directories') {
+ sh(returnStdout: true, script: "rm ${templateEnv} -rf")
+ sh(returnStdout: true, script: "rm ${modelEnv} -rf")
+ }
// common.sendNotification(currentBuild.result,"",["slack"])
}
}