【问题标题】:How do I trigger a Jenkins build from cURL?如何从 cURL 触发 Jenkins 构建?
【发布时间】: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 仍然有同样的问题。

【问题讨论】:

标签: git curl jenkins


【解决方案1】:

下面是第一个问题来捕获 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-21
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 2017-01-28
    • 2014-10-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多