该镜像为Concourse CI/CD平台提供HTTP资源类型支持,允许流水线与HTTP端点进行交互。作为Concourse资源,它可作为输入资源(从HTTP服务获取数据)或输出资源(向HTTP服务发送数据),实现流水线与外部HTTP服务的集成。
在Concourse Pipeline配置中,首先声明HTTP资源类型:
yamlresource_types: - name: http-resource type: docker-image source: repository: [镜像仓库地址] # 例如: concourse/http-resource tag: latest # 建议使用具体版本号
使用声明的资源类型定义具体HTTP资源,配置source参数指定HTTP交互细节:
yamlresources: - name: example-http-resource type: http-resource source: url: "[***]" # 目标HTTP端点URL(必填) method: "GET" # HTTP请求方法(可选,默认GET) headers: # 自定义请求头(可选) Accept: "application/json" User-Agent: "concourse-http-resource/1.0" auth: # 认证配置(可选) type: "basic" # 认证类型,支持"basic"或"bearer" username: "admin" # Basic Auth用户名(type为basic时必填) password: "secret" # Basic Auth密码(type为basic时必填) # token: "xyz123" # Bearer Token(type为bearer时必填) response_filter: ".metadata.version" # JSONPath表达式,提取版本标识(可选) timeout: "30s" # 请求超时时间(可选,默认30s) retry_count: 2 # 请求失败重试次数(可选,默认0) body: '{"param": "value"}' # 请求体内容(POST/PUT等方法时使用,可选)
通过get步骤获取HTTP端点数据,支持自动触发:
yamljobs: - name: process-http-data plan: - get: example-http-resource trigger: true # 当HTTP响应变化时自动触发Job - task: analyze-data config: platform: linux image_resource: type: docker-image source: { repository: alpine } inputs: - name: example-http-resource # 输入资源挂载路径 run: path: sh args: - -c - | # HTTP响应数据默认保存至资源目录下的output文件 cat example-http-resource/output.json # JSON响应示例
通过put步骤向HTTP端点发送数据,支持文件内容作为请求体:
yamljobs: - name: send-to-api plan: - task: generate-payload config: platform: linux image_resource: { type: docker-image, source: { repository: alpine } } outputs: - name: payload # 输出目录,存放请求体文件 run: path: sh args: - -c - | echo '{"status": "success", "build_id": "123"}' > payload/body.json - put: example-http-resource params: file: payload/body.json # 指定请求体文件路径(必填)
| 参数名 | 类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| url | string | 目标HTTP端点完整URL | 是 | - |
| method | string | HTTP请求方法,支持GET/POST/PUT/DELETE等 | 否 | GET |
| headers | map | 请求头键值对,如{ "Content-Type": "application/json" } | 否 | {} |
| auth | map | 认证配置,包含type("basic"或"bearer")及对应凭证 | 否 | - |
| response_filter | string | JSONPath表达式,用于提取版本标识(如.version) | 否 | 响应体哈希值 |
| timeout | string | 请求超时时间,格式为"30s"、"5m"等 | 否 | 30s |
| retry_count | integer | 请求失败重试次数 | 否 | 0 |
| body | string | 直接提供的请求体内容(与file参数二选一,put步骤时使用) | 否 | - |
| file | string | 请求体文件路径(put步骤时使用,与body二选一) | 否 | - |
yamlresource_types: - name: http-resource type: docker-image source: repository: concourse/http-resource tag: v1.2.0 resources: - name: app-config type: http-resource source: url: "[***]" method: "GET" headers: Accept: "application/json" auth: type: "bearer" token: ((config-api-token)) # 引用Concourse密钥管理中的变量 - name: deployment-webhook type: http-resource source: url: "[***]" method: "POST" headers: Content-Type: "application/json" jobs: - name: deploy-with-config plan: - get: app-config trigger: true # 配置更新时自动触发部署 - task: prepare-deploy config: platform: linux image_resource: { type: docker-image, source: { repository: alpine } } inputs: [name: app-config] outputs: [name: deploy-info] run: path: sh args: - -c - | CONFIG_VERSION=$(jq -r .version app-config/output.json) echo '{"version": "'"$CONFIG_VERSION"'", "status": "ready"}' > deploy-info/payload.json - put: deployment-webhook params: file: deploy-info/payload.json # 发送部署信息至webhook

来自真实用户的反馈,见证轩辕镜像的优质服务
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像加速服务
在 Docker Desktop 配置镜像加速
Docker Compose 项目配置加速
Kubernetes 集群配置 Containerd
在宝塔面板一键配置镜像加速
Synology 群晖 NAS 配置加速
飞牛 fnOS 系统配置镜像加速
极空间 NAS 系统配置加速服务
爱快 iKuai 路由系统配置加速
绿联 NAS 系统配置镜像加速
QNAP 威联通 NAS 配置加速
Podman 容器引擎配置加速
HPC 科学计算容器配置加速
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名加速
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429