Jorge Vidinha
Jorge Vidinha

Reputation: 434

Jenkins Trigger builds remotely

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"}]}'

Upvotes: 0

Views: 452

Answers (2)

deepu kumar singh
deepu kumar singh

Reputation: 317

curl -I -u deepusiXXXXXXXX:TOKEN https://jenkins-devops.com/job/testing_pipeline/buildWithParameters?token=abcd1234&BUILDNO=762

-u Provide username:Token generated from jenkins.

Upvotes: 1

Yogesh
Yogesh

Reputation: 4784

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"

Upvotes: 1

Related Questions