大三角帆REST API补丁流水线阶段

时间:2020-01-09 21:35:16

标签: spinnaker

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

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

知道我在做什么错吗? update stage docs尚不清楚阶段ID,但基于管道JSON,它必须是其refId

1 个答案:

答案 0 :(得分:0)

希望以下示例对您有所帮助。 PUTPATCH请求有2个示例。 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": [],
}