【发布时间】:2016-12-14 13:23:35
【问题描述】:
正如许多 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 仍然有同样的问题。
【问题讨论】:
-
@sajibkhan 给出语法问题。
-
@MaTePe 感谢您提供链接,第一个解决了问题: 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
-
我已成功使用:curl -X POST username:secret@10.0.1.58/job/projectname/build 与 Jenkins 2.14。作为我的秘密,我正在使用 api 令牌。您可以在登录时在凭据部分下方生成此信息。您也可以尝试使用常规密码。我认为这也可以。