我正在使用REST API在Jenkins中创建一个新工作.我尝试了下面的curl命令行,但是他们抛出了一个错误
curl -i -X POST --user "admin:<API token>" --data-binary "@C:\mylocalconfig.xml" -H "Content-Type: text/xml" http://localhost:8080/createItem?name=NewJob
curl -X POST -u <username>:<pass> -H "Content-Type:application/xml" -d "@C:\mylocalconfig.xml" "http://localhost:8080/createItem?name=AA_TEST_JOB3"
Run Code Online (Sandbox Code Playgroud)
错误:
HTTP/1.1 403 No valid crumb was included in the request
Date: Fri, 01 Jul 2016 05:25:59 GMT
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=ISO-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 360
Server: Jetty(9.2.z-SNAPSHOT)
<html>
<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 /createItem. Reason:
<pre> No …Run Code Online (Sandbox Code Playgroud) 我想通过向Jenkins发送一个帖子卷曲请求来禁用Jenkins作业.
我试过这样做:
curl -X POST http://<server>:8080/<jobname>/disable curl -X POST http://<server>:8080/<jobname>/disable?token=<token> curl -u <username>:<token> POST http://<server>:8080/<jobname>/disable但每次都失败了.我得到的错误是:
403请求中未包含有效的crumb
这个问题有一个很好的基于卷曲的解决方案吗?
curl -X POST http://xxx.yyy.zzz:5555/job/job-name/build --user john-devops-jenkins:11df3ed41129c5c7da1518e9c3149896de -H 'Jenkins-Crumb:31827a74a160347a641c87ddbc8e3b6e'
Run Code Online (Sandbox Code Playgroud)
上面带有 post 请求的卷曲代码在触发 Jenkins 构建方面绝对工作得很好。
尝试过:
错误:No valid crumb was included in the request
仍然不走运,如何配置 bitbucket hook 到 crumb 的容器头信息或如何通过 url 传递它而不依赖第三方插件?