How to write properly an if statement in regards to a BooleanParameter in Jenkins pipeline Jenkinsfile? -
i'm setting jenkins pipeline jenkinsfile , i'd check if booleanparameter set.
here's relevant portion of file:
node ("master") { stage 'setup' ( [[$class: 'booleanparametervalue', name: 'build_snapshot', value: 'boolean.valueof(build_snapshot)']], as understand, way access booleanparameter i'm not sure how state if statement itself.
i thinking doing like:
if(booleanparametervalue['build_snapshot']){... what correct way write statement please?
the answer way simpler ! according pipeline documention, if define boolean parameter isfoo can access in groovy name, script :
node { stage 'setup' echo "${isfoo}" // usage inside string if(isfoo) { // simple "if" usage echo "param isfoo true" ... } } and way, should'nt call parameter build_snapshot maybe buildsnapshot or isbuildsnapshot because parameter , not constant.
Comments
Post a Comment