Editable Choice plugin is a Jenkins plugin providing editable choice parameter feature, that is, you can select a value from choices or you can input any value even not in choices.
You can use Editable Choice in your job just like built-in choice paraemters:
pipeline {
agent any
parameters {
editableChoice(
name: 'PARAM1',
choices: ['Apple', 'Grape', 'Orange'],
)
}
stages {
stage('build') {
steps {
echo "PARAM1=${params.PARAM1}"
}
}
}
}
You can enter a parameter value in a build page:
You can also configure it for GUI-based jobs like freestyle projects:
Full pipeline example:
editableChoice(
name: 'PARAM1',
description: 'Choose your favorite fruit`
choices: ['Apple', 'Grape', 'Orange'],
defaultValue: 'Grape',
restrict: true,
filterConfig: filterConfig(prefix: true, caseInsensitive: true),
)
parameter | type | required | description |
---|---|---|---|
name |
string |
yes |
The name of the parameter |
description |
string |
The description for the parameter |
|
choices |
list of strings |
yes |
Choices |
defaultValue |
string |
The initial value. Uses the top most value if not specified. |
|
restrict |
boolean |
Restrict the input value to be a value in choices. Otherwise, you cannot submit the build. |
|
filterConfig |
filterConfig |
Display only choices matching with current input. The choice behaves like suggestions. |
parameters for filterConfig
:
parameter | type | required | description |
---|---|---|---|
prefix |
boolean |
Match the input only with prefix of choices |
|
caseInsensitive |
boolean |
Match in case insensitive |
Report issues and enhancements in the Jenkins issue tracker.
Available in GitHub Release page.
Refer to our contribution guidelines.
Licensed under MIT, see LICENSE.