Adjusting parameters

master
Patryk Gudalewicz 2022-10-28 10:25:13 +02:00
parent ce782dc70d
commit b86f267408
1 changed files with 8 additions and 8 deletions

16
Jenkinsfile vendored
View File

@ -7,7 +7,7 @@ pipeline {
parameters {
string(name: 'CLUSTER', defaultValue: '', description: 'Enter the cluster name')
choice(name: 'ENVIRONMENT', choices: ['euprod', 'eupreprod', 'napreprod', 'naprod', 'cnprod', 'cnpreprod'], description: 'Choose Dynatrace environment')
string(name: 'OWNER', defaultValue: '', description: 'Enter e-mail address of dashboard owner')
string(name: 'OWNER', defaultValue: '', description: 'Enter e-mail address of dashboard owner. Optional if REMOVE parameter is set to true')
booleanParam(name: 'REMOVE', defaultValue: false, description: 'Check if dashboard for provided cluster should be removed instead of created')
}
@ -47,15 +47,16 @@ pipeline {
steps {
script {
def SCRIPT_PARAMETER = ''
if(CLUSTER.isEmpty()) {
if(CLUSTER.isEmpty() || ENVIRONMENT.isEmpty()) {
currentBuild.result = 'ABORTED'
error('Aborting due to missing CLUSTER parameter')
error('Aborting due to missing CLUSTER or ENVIRONMENT parameters')
return
}
else if(ENVIRONMENT.isEmpty()) {
currentBuild.result = 'ABORTED'
error('Aborting due to missing ENVIRONMENT parameter')
return
else if(REMOVE.toBoolean()) {
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " -C " + CLUSTER.toString()
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " -E " + ENVIRONMENT.toString()
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " --remove "
sh "python createDash.py ${SCRIPT_PARAMETER}"
}
else if(OWNER.isEmpty()) {
currentBuild.result = 'ABORTED'
@ -66,7 +67,6 @@ pipeline {
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " -C " + CLUSTER.toString()
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " -E " + ENVIRONMENT.toString()
SCRIPT_PARAMETER = SCRIPT_PARAMETER + " -O " + OWNER.toString()
if(REMOVE.toBoolean()) { SCRIPT_PARAMETER = SCRIPT_PARAMETER + " --remove "}
sh "python createDash.py ${SCRIPT_PARAMETER}"
}
}