6.20. 使用 Red Hat Quay API 管理构建
可使用 Red Hat Quay API 管理构建。
步骤
使用
GET /api/v1/repository/{repository}/trigger/端点列出指定存储库的触发器:$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/" \ -H "Authorization: Bearer <your_access_token>"输出示例
{"triggers": [{"id": "32ca5eae-a29f-46c7-8f44-3221ca417c92", "service": "custom-git", "is_active": false, "build_source": null, "repository_url": null, "config": {}, "can_invoke": true, "enabled": true, "disabled_reason": null}]}使用
POST /api/v1/repository/{repository}/trigger/{trigger_uuid}/activate端点来激活指定的构建触发器。$ curl -X POST "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/activate" \ -H "Authorization: Bearer <your_access_token>" \ -H "Content-Type: application/json" \ -d '{ "config": { "branch": "main" }, "pull_robot": "example+robot" }'使用
POST /api/v1/repository/{repository}/trigger/{trigger_uuid}/start端点从指定的触发器手动启动构建:$ curl -X POST "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/start" \ -H "Authorization: Bearer <your_access_token>" \ -H "Content-Type: application/json" \ -d '{ "branch_name": "main", "commit_sha": "abcdef1234567890", "refs": "refs/heads/main" }'使用
GET /api/v1/repository/{repository}/trigger/{trigger_uuid}/builds端点来列出由指定触发器启动的构建:$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid/builds?limit=10" \ -H "Authorization: Bearer <your_access_token>"使用
GET /api/v1/repository/{repository}/trigger/{trigger_uuid}端点获取指定构建触发器的信息:$ curl -X GET "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \ -H "Authorization: Bearer <your_access_token>"使用
PUT /api/v1/repository/{repository}/trigger/{trigger_uuid}端点更新指定的构建触发器:$ curl -X PUT "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \ -H "Authorization: Bearer <your_access_token>" \ -H "Content-Type: application/json" \ -d '{"enabled": true}'使用
DELETE /api/v1/repository/{repository}/trigger/{trigger_uuid}端点删除指定的构建触发器:$ curl -X DELETE "https://quay-server.example.com/api/v1/repository/example_namespace/example_repo/trigger/example-trigger-uuid" \ -H "Authorization: Bearer <your_access_token>"