更新时间:2024-08-22 GMT+08:00
分享

回退执行流水线

功能介绍

回退执行流水线

调用方法

请参见如何调用API

URI

POST /v5/{project_id}/api/pipelines/{pipeline_id}/pipeline-runs/{pipelineRunId}/rollback-run

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释: CodeArts项目ID。 约束限制: 不涉及 取值范围: 32位字符。 默认取值: 不涉及。

pipeline_id

String

参数解释: 流水线ID。 约束限制: 不涉及 取值范围: 32位字符。 默认取值: 不涉及。

pipelineRunId

String

流水线运行实例ID

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

sources

Array of sources objects

流水线源

description

String

运行描述

variables

Array of variables objects

运行参数

choose_jobs

Array of strings

选择运行的任务

choose_stages

Array of strings

选择运行的阶段

表3 sources

参数

是否必选

参数类型

描述

type

String

流水线源类型

params

params object

流水线源参数

表4 params

参数

是否必选

参数类型

描述

git_type

String

GIT仓库类型

codehub_id

String

CODEHUB仓库ID

default_branch

String

默认分支

git_url

String

GIT仓库下载链接

alias

String

仓库别名

endpoint_id

String

扩展点ID

build_params

build_params object

构建参数

表5 build_params

参数

是否必选

参数类型

描述

build_type

String

构建类型

event_type

String

事件类型

target_branch

String

目标分支

tag

String

标签名称

表6 variables

参数

是否必选

参数类型

描述

name

String

参数名称

sequence

Integer

参数序号

type

String

参数类型

value

String

参数值

is_secret

Boolean

是否私密

description

String

描述

is_runtime

Boolean

是否运行时设置

limits

Array of strings

参数限制

is_reset

Boolean

是否重置

latest_value

String

最后一次运行的值

required

Boolean

是否必输

variableGroupName

String

参数组名称

响应参数

状态码: 200

表7 响应Body参数

参数

参数类型

描述

pipeline_run_id

String

参数解释: 流水线运行实例ID。 取值范围: 32位字符,仅由数字和字母组成。

请求示例

https://(endpoint)/v5/db8d07265e24426598b3eb03a7818972/api/pipelines/d7013d2402ff4cc88489ee5af324e049/pipeline-runs/6d65dd0bc411451b8fb70e8535eda3d8/rollback-run

{
  "sources" : [ {
    "type" : "code",
    "params" : {
      "git_type" : "codehub",
      "codehub_id" : "123456",
      "default_branch" : "master",
      "git_url" : "https://0001.git",
      "alias" : "",
      "endpoint_id" : "",
      "build_params" : {
        "build_type" : "branch",
        "event_type" : "Manual",
        "target_branch" : "master",
        "tag" : null
      }
    }
  } ],
  "description" : "",
  "variables" : [ {
    "name" : "1",
    "sequence" : 1,
    "type" : "string",
    "value" : "1",
    "is_secret" : false,
    "description" : "",
    "is_runtime" : false,
    "limits" : [ ],
    "is_reset" : false,
    "latest_value" : "",
    "required" : true,
    "variableGroupName" : null
  }, {
    "name" : "2",
    "sequence" : 2,
    "type" : "string",
    "value" : "2",
    "is_secret" : false,
    "description" : "",
    "is_runtime" : false,
    "limits" : [ ],
    "is_reset" : false,
    "latest_value" : "",
    "required" : true,
    "variableGroupName" : null
  } ],
  "choose_jobs" : [ "Task_1" ],
  "choose_stages" : [ "state_4" ]
}

响应示例

状态码: 200

响应体

{
  "pipeline_run_id" : "d5e642b122fd453dbaff21d90dee5ac1"
}

状态码

状态码

描述

200

响应体

错误码

请参见错误码

相关文档