passing parameter to jenkins job through curl POST not working?

心不动则不痛 提交于 2019-12-05 09:31:30

I'm using:

curl -X POST -u "user" "http://myjenkins/path/to/my/job/buildWithParameters?GERRIT_REFNAME=feature/retry&goal=package"

here and it's working like a charm.

Watch out the "=" in front of the "PARAMETER" in the URL you pasted.

Please try something like:

curl -X POST http://<jenkins URL>/jenkins/job/TESTS/job/<Your job's Name>/buildWithParameters \
  --user <Jenkins account>:<account's TokenID>  \
  --data token=<job's token (if required)> \
  --data parameter=some_value
  ...
  --data MessageTextParameter=My%20Text
GangaRam Dewasi

I used below command to pass Multiple parameter.

curl -X POST "https://myjenkins.com/job/jobname/buildWithParameters?token=developer&name=abc&userid=CFDH123&mail=abc@gmail.com"

Note: parameter names are case sensitive.

Muralidhar BN

When I tried

curl -X POST http://icm.git:faedc992afcd1ea4db3da6809435117a@10.221.31.36:8080/job/1_TODO_Get_Submit_Request_With_Dependency_Test/buildWithParameters?PARAMETER=1494390553639

OR

curl -X POST -u "icm.git:lge123" -H Jenkins-Crumb:faedc992afcd1ea4db3da6809435117a http://10.221.31.36:8080/job/1_TODO_Get_Submit_Request_With_Dependency_Test/buildWithParameters?PARAMETER=1494390553639

Both triggered Jenkins Job > 1_TODO_Get_Submit_Request_With_Dependency_Test but the parameter in Jenkins log showed default value for parameter REQUESTID = -1.

What is problem with Jenkins or CURL url ?

+ echo '4.2.25(1)-release'
4.2.25(1)-release
+ echo

+ echo 26
26
+ echo '#26'
#26
+ echo 1_TODO_Get_Submit_Request_With_Dependency_Test
1_TODO_Get_Submit_Request_With_Dependency_Test
+ echo 1_TODO_Get_Submit_Request_With_Dependency_Test
1_TODO_Get_Submit_Request_With_Dependency_Test
+ echo REQUESTID = -1
REQUESTID = -1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!