Move deleting of stack to right place in `Test - Drivetrain` pipeline
Change-Id: Iadbd861144ec74c670440defcfb67deb6890cd65
diff --git a/test-drivetrain.groovy b/test-drivetrain.groovy
index ec3286c..ebbf731 100644
--- a/test-drivetrain.groovy
+++ b/test-drivetrain.groovy
@@ -109,18 +109,16 @@
//runJobOnJenkins(jenkinsUrl, "admin", stackCicdPassword, "cvp-dt-func", "-p SETTINGS=${FUNC_TEST_SETTINGS}")
}
- stage('Delete Heat Stack') {
- if(DELETE_STACK.toBoolean()){
- mcpEnvJob = build(job: "delete-heat-stack-for-mcp-env", parameters: [
- [$class: 'StringParameterValue', name: 'OS_PROJECT_NAME', value: 'mcp-mk'],
- [$class: 'StringParameterValue', name: 'STACK_NAME', value: 'jenkins-drivetrain-test-' + currentBuild.number],
- ])
- }
- }
-
} catch (Throwable e) {
currentBuild.result = 'FAILURE'
throw e
+ } finally{
+ if(DELETE_STACK.toBoolean() && ENVIRONMENT_IP == ""){
+ mcpEnvJob = build(job: "delete-heat-stack-for-mcp-env", parameters: [
+ [$class: 'StringParameterValue', name: 'OS_PROJECT_NAME', value: 'mcp-mk'],
+ [$class: 'StringParameterValue', name: 'STACK_NAME', value: 'jenkins-drivetrain-test-' + currentBuild.number],
+ ])
+ }
}
}
}
\ No newline at end of file