In jenkins how to restrict users to select first default element with other options in extended choice parameter
-
I have a jenkins job with multi select extended choice parameter. There are list of elements in a parameter. So, my requirement is I want to allow users to select multiple parameters excluding first element in a parameter. Means user should not able to select first element with other elements in a parameters. I am using jenkinsfile to create parameter.
Like shown above, users should not able to select 'None' with any other element in a parameter. Does anyone know how to do this?
-
It's probably easier to create two separate parameters. E.g.:
Run tests? (boolean parameter)
If running tests, select tests (multi-select choice parameter)
Then you could code your job to skip all tests if the first parameter is false, otherwise it would run the selected tests.
If you want to get really fancy, you can use the https://plugins.jenkins.io/uno-choice/ to dynamically show the list of tests parameter only if the "run tests" parameter is also selected.