DEV Community

Discussion on: Jenkins Pipelines and their dirty secrets 2.

Collapse
 
pinkeen profile image
Filip Sobalski

I found another way to prevent jenkins from overriding parameter values with each run. Seems to be working with latest declarative pipelines:

string(name: 'BRANCH', defaultValue: params.BRANCH ?: 'master')
Enter fullscreen mode Exit fullscreen mode

If no param yet then it will use master, otherwise it will use whatever has been set in the defaults "manually" in the job configuration.

Collapse
 
ajaysuwalka profile image
Ajay Suwalka

Thanks a lot, Crazily This info is not available any where.

Collapse
 
siddarajugc profile image
siddarajugc

HI Filip, Thanks a lot for this info.
I can use above code for string parameter but not for boolean Or choice parameter, can you please provide the details on how to use same for boolean/choice parameter