I have made progress - using --data-urlencode json="$Params" will trigger 
the build though the parameters I send over - P4USER and EMAIL_ADDR are 
blank in the environment variables.



On Wednesday, September 14, 2016 at 7:50:57 AM UTC-7, gessn...@gmail.com 
wrote:
>
>
>
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7f98d7f1-eeb7-4e38-b538-d0d885d4b0b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to