问题
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()
来源:https://stackoverflow.com/questions/42234822/how-to-check-if-parameter-variable-is-available-for-jenkins-build-with-paramete