I'm having a problem with a Jenkins multibranch pipeline, which is parameterized. The parameters are all declared in the Jenkinsfile.
The problem is that these parameters do not exist on the very first run of the job. So, the very first execution will fail with groovy.lang.MissingPropertyException
. Any subsequent run is now aware of the parameters and will not fail.
Since this is a multibranch pipeline this happens for every new pull request or tracked branch. Is there any workaround to avoid this problem?
I tried setting the parameters in the UI as well, however there is no option on the pipeline configuration page to set parameters. Probably because this is a multibranch pipeline?
Cheers
This is a known issue with Parameters in Pipelines. To know which parameters are needed, Jenkins needs to execute the Jenkinsfile once. For example the parameters in the GUI are not available until after the first run of the pipeline.
To prevent errors, you could specify sensible default values like this: