How do I use Jenkins Pipeline properties step? How do I use Jenkins Pipeline properties step? jenkins jenkins

How do I use Jenkins Pipeline properties step?


Using properties with explicit method syntax will work, i.e.:
properties( [ ... ] ) rather than properties [ ... ]

Alternatively, it will work without if you specify the parameter name, e.g.:

properties properties: [ ... ]

For example defining three properties is as easy as :

properties([  parameters([    string(name: 'submodule', defaultValue: ''),    string(name: 'submodule_branch', defaultValue: ''),    string(name: 'commit_sha', defaultValue: ''),  ])])/* Accessible then with : params.submodule, params.submodule_branch...  */


Multiple choice in Jenkins scripted pipeline

properties([  parameters([        choice(choices: 'sprint_6\nsprint_7\nsprint_8\nSprint_9', description: 'Select branch to Build', name: 'Branch'),        choice(choices: 'No\nYes', , name: 'choice2'),        choice(choices: 'No\nYes', name: 'choice3')  ])])