Skip to content

Commit 913b87a

Browse files
do not cleanup if using DEBUG (#39)
* do not cleanup if using DEBUG * show node/executor info * add slack message to manually clean up if DEBUG
1 parent ee3b391 commit 913b87a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

vars/build_stages.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def runDebugInfo() {
2727

2828
// Display environment variables from Jenkins.
2929
echo """Environment:
30+
NODE_NAME: '${NODE_NAME}'
31+
EXECUTOR_NUMBER: '${EXECUTOR_NUMBER}'
3032
ACTIVATE: '${ACTIVATE}'
3133
BUILD_NUMBER: '${BUILD_NUMBER}'
3234
BRANCH: '${BRANCH}'

vars/reusable_pipeline.groovy

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,13 @@ def call(Map config = [:]){
161161
}
162162
} finally {
163163
// Cleanup
164-
buildStages.cleanup()
164+
script {
165+
if (params.DEBUG) {
166+
echo 'Debug was enabled - MANUALLY CLEAN UP WHEN FINISHED.'
167+
} else {
168+
buildStages.cleanup()
169+
}
170+
}
165171
}
166172
}
167173
}
@@ -201,6 +207,14 @@ def call(Map config = [:]){
201207
Author: @${slackID}
202208
Build details: <${env.BUILD_URL}/console|See in web console>
203209
""".stripIndent()
210+
if (params.DEBUG) {
211+
slackMessage += """
212+
213+
Debug was enabled - MANUALLY CLEAN UP WHEN FINISHED.
214+
1. Env path: ${conda_env_dir}/${conda_env_name}
215+
2. Workspace: ${env.WORKSPACE}
216+
""".stripIndent()
217+
}
204218
}
205219
}
206220
failure {
@@ -224,6 +238,7 @@ def call(Map config = [:]){
224238
}
225239
}
226240
cleanup { // cleanup for outer workspace
241+
// NOTE: We always clean up this outer workspace regardless of DEBUG
227242
cleanWs()
228243
// manually remove @tmp dirs
229244
dir("${WORKSPACE}@tmp"){

0 commit comments

Comments
 (0)