Refactored pipelines to use library method for testing input params
Change-Id: Iaae514c0a960fef43d753712be20aec06086f39b
diff --git a/cleanup-pipeline.groovy b/cleanup-pipeline.groovy
index 282b041..cf6252e 100644
--- a/cleanup-pipeline.groovy
+++ b/cleanup-pipeline.groovy
@@ -33,7 +33,7 @@
def env_vars
// default STACK_TYPE is heat
- if (!env.getEnvironment().containsKey("STACK_TYPE") || STACK_TYPE == '') {
+ if (!common.validInputParam(STACK_TYPE)) {
STACK_TYPE = 'heat'
}
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 50a9e54..6683910 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -216,7 +216,7 @@
// Set up override params
- if (env.getEnvironment().containsKey('SALT_OVERRIDES')) {
+ if (common.validInputParam('SALT_OVERRIDES')) {
stage('Set Salt overrides') {
salt.setSaltOverrides(saltMaster, SALT_OVERRIDES)
}
@@ -415,12 +415,12 @@
// Clean
//
- if (env.getEnvironment().containsKey('STACK_NAME') && STACK_NAME != '') {
+ if (common.validInputParam('STACK_NAME')) {
// send notification
common.sendNotification(currentBuild.result, STACK_NAME, ["slack"])
}
- if (env.getEnvironment().containsKey('STACK_DELETE') && STACK_DELETE.toBoolean() == true) {
+ if (common.validInputParam('STACK_DELETE') && STACK_DELETE.toBoolean() == true) {
stage('Trigger cleanup job') {
common.errorMsg('Stack cleanup job triggered')
build(job: STACK_CLEANUP_JOB, parameters: [
@@ -440,7 +440,7 @@
if (currentBuild.result == 'FAILURE') {
common.errorMsg("Deploy job FAILED and was not deleted. Please fix the problem and delete stack on you own.")
- if (env.getEnvironment().containsKey('SALT_MASTER_URL')) {
+ if (common.validInputParam('SALT_MASTER_URL')) {
common.errorMsg("Salt master URL: ${SALT_MASTER_URL}")
}
}