down votefavorite 
<http://stackoverflow.com/questions/39479258/using-curl-to-trigger-a-build-on-jenkins#>

I am trying to write a bash script to start a build on Jenkins. It works 
but the problem I am having is with passing parameter values.

I have: curl -X POST $Server -d token='MyToken' --data-urlencode json='{ 
... }' and I want to replace the json='{...}' with a variable as in 
json=$Params where my json string is '{"parameters": [{"name":"USER", 
"value":"Tim"}]}'

This json string works when I specify it on the command line but not 
however when I put it in a variable. With the variable I get a stack trace 
and html - several screens worth.

When assigning to a variable a have tried several things though currently I 
have Params="{\"parameters\": [{\"name\":\"USER\", \"value\":\"Tim\"}]}"

It appears that it can't parse my json when I pass it through $Params but 
can in the other case.

What I am trying to do is get the user name passed in from a perforce 
trigger, then get that users email address. I have that working assigning 
to a variable @UserEMail. I then want to pass that in the json value. I 
haven't gotten to the point of replacing "Tim" with the value from 
@UserEmail.

Thank you for any help.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ea7bd079-55de-48a1-a003-1f1b748debd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to