0
votes

Im trying to use Jenkins Trigger builds remotely.

I have set up the my API token at MY USER -> configure -> API Token.

At my job i have set Trigger builds remotely (e.g., from scripts) and passed MY_TOKEN value there.

Now when i try to run the job via cURL call bellow, the python script that should receive the exposed arguments via sys.argv[] is not receiving the parameters sent on the cURL call as below.

If i run the job manualy providing the arguments as jenkins string parameters it runs smooth, receiving the arguments fine.

curl -X POST JENKINS_URL/JOB/buildWithParameters  --user MY_USER:MY_TOKEN  --data-urlencode json='{"parameter": [{"name":"folder", "value":"\\\\1234\\123\\12\\1\\"}, {"name":"schema", "value":"source"}]}'
2
is folder and schema your build parameter names? - Yogesh
hi yes those are my parameters - Jorge Vidinha
Can you inspect the HTTP POST request that curl sends? - handras

2 Answers

1
votes

You should send build parameters individually as bellow

curl -X POST JENKINS_URL/JOB/buildWithParameters  --user MY_USER:MY_TOKEN \
 --data folder="\\\\1234\\123\\12\\1\\" \
 --data schema="source"
1
votes
curl -I -u deepusiXXXXXXXX:TOKEN https://jenkins-devops.com/job/testing_pipeline/buildWithParameters?token=abcd1234&BUILDNO=762

-u Provide username:Token generated from jenkins.