大三角帆 REST API 补丁管道阶段



我正在尝试通过其 REST API 修补 spinnaker 中管道的特定阶段:

curl -X PATCH 
http://localhost:8082/pipelines/45042993-ff77-4cc5-b8f5-cb28b1902173/stages/8 
-d @/tmp/dtool_spinnaker_pipelinev_stage.json 
-H "Content-Type: application/json" 
--silent 
--show-error

这使我找不到404错误页面。发布整个管道工作:

curl -X POST 
http://localhost:8082/pipelines/45042993-ff77-4cc5-b8f5-cb28b1902173 
-d @/tmp/dtool_spinnaker_pipelinev.json 
-H "Content-Type: application/json" 
--silent 
--show-error

知道我做错了什么吗?更新阶段文档不清楚阶段 ID,但根据管道 JSON,它必须是它的refId

我希望以下示例对您有所帮助。有 2 个PUTPATCH请求的示例。PATCH修改阶段结果并PUT重新运行它。预计要运行额外的管道 - 在我的情况下,它会等待 5 秒并检查输入参数。

{
"expectedArtifacts": [],
"keepWaitingPipelines": false,
"limitConcurrent": true,
"parameterConfig": [
{
"default": "false",
"description": "",
"hasOptions": false,
"label": "success",
"name": "success",
"options": [
{
"value": "false"
},
{
"value": ""
}
],
"pinned": false,
"required": true
}
],
"stages": [
{
"completeOtherBranchesThenFail": false,
"continuePipeline": false,
"failPipeline": false,
"method": "PUT",
"name": "PUT",
"payload": {
"continuePipeline": false,
"failPipeline": true
},
"refId": "3",
"requisiteStageRefIds": [
"7"
],
"stageEnabled": {
"expression": "(#stage('Pipeline')).toString == 'TERMINAL'",
"type": "expression"
},
"statusUrlResolution": "getMethod",
"type": "webhook",
"url": "http://spin-gate:8084/pipelines/${execution.id}/stages/${#stage('Pipeline').id}/restart",
"waitForCompletion": false
},
{
"name": "Wait 2",
"refId": "5",
"requisiteStageRefIds": [
"3",
"6"
],
"type": "wait",
"waitTime": 5
},
{
"application": "ads-demo-app",
"completeOtherBranchesThenFail": false,
"continuePipeline": true,
"failPipeline": false,
"name": "Pipeline",
"pipeline": "d7c5d33c-c250-48d8-a7c3-5e0a951bb806",
"pipelineParameters": {
"success": "false"
},
"refId": "6",
"requisiteStageRefIds": [],
"type": "pipeline",
"waitForCompletion": true
},
{
"method": "PATCH",
"name": "PATCH",
"payload": {
"continuePipeline": false,
"failPipeline": true,
"pipelineParameters": {
"success": "true"
}
},
"refId": "7",
"requisiteStageRefIds": [
"6"
],
"statusUrlResolution": "getMethod",
"type": "webhook",
"url": "http://spin-gate:8084/pipelines/${execution.id}/stages/${#stage('Pipeline').id}"
}
],
"triggers": [],
}

最新更新