I have a pipeline script that should work with and without parameters. So I have to check if the parameter is available.
I tried if(getBinding().hasVariable(\"mypa
This is how I did that:
def myParam = false
if (params.myParam != null){
myParam = params.myParam
}
Why do that at all when you can just define parameters in your pipeline as suggested above?
Well, there are situations when you want your pipeline file to work regardless of if parameter is defined or not. I.e., if you're re-using your pipeline script from different Jenkins jobs and you don't want to make people define that parameter ...