繁体   English   中英

如何从cURL触发Jenkins构建?

[英]How do I trigger a Jenkins build from cURL?

正如许多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仍然存在相同的问题。

下面是捕获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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM