Hi, You are right. This has affected me too, since I use the same technique as you to figure out if a parameter exists.
I think that the way that build parameters are accessed inside pipeline scripts has been changed in workfow-cps-plugin 2.17 as part of: https://issues.jenkins-ci.org/browse/JENKINS-29952 Can you can try something like: node { envVars = env.getEnvironment() println envVars.containsKey("MY_PARAM") println enVars.containsKey("MY_PARAM2") } The alternative is to try accessing MY_PARAM and handle any exception thrown if the parameter does not exist, as pointed out by Michael Lasevich. -- Craig On Thu, Sep 29, 2016 at 1:37 AM, Sverre Moe <sverre....@gmail.com> wrote: > 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 jenkinsci-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jenkinsci-users/1902854d-b8a5-439f-8bc6-74a0f6b43762%40googlegroups. > com > <https://groups.google.com/d/msgid/jenkinsci-users/1902854d-b8a5-439f-8bc6-74a0f6b43762%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAG%3DrPVdj4cLr_esf1tc4-JoQMb6S6X_RuU8ejHyu1xTV7GpB%2BA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.