我正在使用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) 我正在使用 docker-compose。我有一个网络和一个工人服务。
version: '3'
services:
web:
build: .
environment:
- "*"
links:
- redis
- memcached
ports:
- "80:8001"
- "443:8001"
worker:
build: .
command: ["/bin/bash", "/home/django/start_celery.sh"]
environment:
- "*"
links:
- redis
- memcached
memcached:
image: memcached
ports:
- "11211:11211"
redis:
image: redis
ports:
- "6379:6379"
Run Code Online (Sandbox Code Playgroud)
我需要在工作服务上运行 crons(计划任务)。
而且我不想在 Dockerfile 中对 crontab 进行硬编码,因为我对这两个服务使用相同的 dockerfile。
那么最好的方法是什么?