I have the below pipeline script with string parameters. The Target parameter will fail if multiple comma separated inputs are provided in Jenkins. How can I restrict the Jenkins pipeline to accept just one value as parameter and not multiple comma separated values.

    string(defaultValue: '', description: '', name: 'ID'),
    string(defaultValue: '', description: '', name: 'Target')

1 Answer 1


Extended Choice Parameter plugin is the way to go for such requirement. You need to select Extended Choice Parameter from the drop-down list as shown below:

enter image description here

enter image description here

In Name text-box, assign a name. For example, Environment. This is the name with which you will be accessing all the values (dev1,dev2,...) that you will select while triggering the build. Now, in Simple Parameter Types section, you will see another drop-down with the name Parameter Type. Select Multi Select from that drop-down. Now, in Choose Source for Value section, enter the values (dev1,dev2,qa1,qa2,...) in Value box. Comma (,) is the default delimiter. Refer screenshot below:

enter image description here

enter image description here

Once you are done with the above settings, you will then have to access the selected option in your script (using variable assigned to Name as described above) and decide the course of action.

  • Harsh Manvar, thanks. Cant we restrict the parameters as a first step and throw an exception? My interest is in string parameter input and not choice parameters. Only one parameter (servername) is input for a build to execute, no comma separated inputs like (servername1,servername2) must be provided.
    – Narasimha
    Commented Feb 7, 2019 at 6:58
  • maybe possible it is have to check or implement or try ...i have not tried it Commented Feb 7, 2019 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.