Single parameter with multiple values - referencing extended-choice parameter values

jenkins

Solution

Extended-choice parameter will always list its selected values as `TARGET=value1,value2`. At best, you can enforce the values to be quoted like this `TARGET="value1,value2"`

You have to parse this `TARGET` value to get it into the format you want.

If you could pass targets to `make` in sequence, like `make value1 value2`, all you would need is to change that comma `,` in value of `TARGET` to a space ``. You didn't provide your OS, so I will assume *nix. You can use the following to quickly do that `${TARGET//,/ }`

Finally, since `make` does not appear to support multiple targets (according to OP), we need a loop.

So, in your Jenkins Execute Shell build step, type:

for currentTarget in ${TARGET//,/ }; do
    make $currentTarget
done

This will be equivalent to:

make value1
make value2

As for the order of thing: the order of these values will always be same as they are defined in job configuration. It doesn't matter in what order the user chooses these.

Problem

I am stuck with the following situation in Jenkins. A job needs to build multiple `make` targets. This will happen through multiple invocations of `make` per run as it allows only 1 target at a time. I want to allow users to select which targets to build with each run. I tried with `extended-choice parameter` plugin (Multi-select), but could not figure out how to parse multiple values from it, and how to structure my call to `make` Can someone help me with this

Original source