正如许多Stack Overflow问题所示,我尝试通过以下cURL组合触发Jenkins作业。但是,似乎都没有效果。
curl -X POST http://localhost:8080/job/someJob/build?delay=0sec --user user:password
curl -X POST -u user:password http://localhost:8080/job/testjob/build
然而,我得到了:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /job/testjob/build. Reason:
<pre> No valid crumb was included in the request</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
</body>
</html>
我尝试过使用Postman,但是wget仍然有同样的问题。
答案 0 :(得分:0)
下面的第一个问题是捕获CRUMB:
CRUMB=$(curl -s 'git:git@localhost:8080/crumbIssuer/api/xml?xpath=concat(//…)
然后:
curl -X POST -H $CRUMB -u git:git localhost:8080/job/testjob/build