How to check if parameter/variable is available for Jenkins "Build with Parameters" in Groovy

How to check if parameter/variable is available for Jenkins "Build with Parameters" in Groovy,jenkins,jenkins-pipeline,Jenkins,Jenkins Pipeline,We used to be able to check if a parameter is available via: binding.variables.containsKey() or getBinding().hasVariable() But that no longer works at least as of Jenkins v 2.39. (These functions work for variables set within the groovy script but not the parameters from 'Build with Parameters'.)

We used to be able to check if a parameter is available via:

binding.variables.containsKey()

or

getBinding().hasVariable()

But that no longer works at least as of Jenkins v 2.39. (These functions work for variables set within the groovy script but not the parameters from 'Build with Parameters'.)


#1

Instead of using binding.variables.containsKey() to check, you should use:

params.containsKey()