I'm trying to pass parameters while triggering Jenkins from a shell script.
I succeeded in passing only string params and unfortunately I didn't find any way how to pass extended-choice-parameter. I searched a lot of time, but the few solutions which I found didn't serve my needs.
curl -X POST -u $user_name:$api_token_string http://{my jenkins server}/job/{my job}/$branch/buildWithParameters?token=$api_token_name
--data myParam=$myValue --data myOptions=option1 --data myOptions=option2
This code works well. It triggers the right job and passes the params. When "myParam" is a string parameter in the Jenkins pipeline and "myOptions" is an extended-choice-parameter in Jenkins pipeline.
The problem is that I can't use this code because "option1" and "option2" are arguments of my shell script and I can't know from advanced how many options the user will send (maybe 5 args).
I've tried to pass "options" as an array in several ways:
--data myOptions=options
--data myOptions=${options[*]}
--data myOptions=${options[@]}
but the pipeline knew only the first value of the array :(
so- any idea how to pass extended-choice-parameter (when there are multiple choices) or maybe in other words- how to pass an array to Jenkins pipeline from a shell script?
question from:
https://stackoverflow.com/questions/65871906/jenkins-remotely-triggered-build-how-to-pass-extended-choice-parameter 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…