I can no longer check if a build parameter exist before accessing it

This has worked previously before I updated Jenkins and the Pipeline 
plugins:
def myParam = false
if (getBinding().hasVariable("MY_PARAM")) {
    myParam = Boolean.parseBoolean(MY_PARAM)
}


final def myParam = MY_PARAM


The latter will fail on the very first build on all new branches that are 
added.


This will print out only for the second println.
if (getBinding().hasVariable("MY_PARAM")) {
    println "My_PARAM1="+MY_PARAM
}
println "MY_PARAM2="+MY_PARAM
Output: 
MY_PARAM2=false

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1902854d-b8a5-439f-8bc6-74a0f6b43762%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to