0

Is it possible to build an array from a parameterized jenkins build?

I have tried the https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin which allows me to create a single title with multiple options within it. So I build a extended choice called services with 5 services listed as check boxes.

However when I try to do a loop over what I thought would be an array ${services[@]} I just get the single value of comma separated values. I tried setting IFS=',' and that does not work.

Any ideas?

2 Answers 2

1

This just doesn't work with check boxes. If you use a text field and specify each variable there it will loop as if it were a true array.

Sign up to request clarification or add additional context in comments.

Comments

0

You can create an array first from Jenkins multiple choice variable:

IFS=',' read -r -a services <<< "$services"

for service in ${services[@]}; do
    echo "$service"
done

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.