Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set default value for ChoiceParameterDefinition parameter

I am using jenkins Pipeline and trying to use parameters ( Inputs ) Like .e.g.

[$class: 'ChoiceParameterDefinition', choices: ['ADD','SHOW','DELETE','UPDATE','RESET'], description: 'Choose an Operation', name: ''].

How to set default value for ChoiceParameterDefinition ?

like image 238
Net Sim Avatar asked Oct 19 '25 14:10

Net Sim


1 Answers

The Choice parameter doesn't have the option to use 'defaultValue' like f.e. StringParameter See also https://jenkins.io/doc/book/pipeline/syntax/#parameters.

However, the first choice in your list will be picked as the default. See also the help section when configuring parameters.

Choice parameter help

Example if you want to have the default value to be empty:

[$class: 'ChoiceParameterDefinition', choices: ['','ADD','SHOW','DELETE','UPDATE','RESET'], description: 'Choose something', name: '']
like image 59
Unforgettable631 Avatar answered Oct 21 '25 13:10

Unforgettable631