文档首页/ 流水线 CodeArts Pipeline/ API参考/ API/ 流水线管理/ 回退执行流水线 - RollbackRunPipeline
更新时间:2026-09-24 GMT+08:00

回退执行流水线 - RollbackRunPipeline

功能介绍

回退执行流水线

调用方法

请参见如何调用API。

URI

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

表1 路径参数

参数

是否必选

参数类型

描述

project_id

是

String

参数解释:

项目ID,获取方式请参见获取项目ID。

约束限制:

不涉及。

取值范围:

32位字符,由数字和字母组成。

默认取值:

不涉及。

pipeline_id

是

String

参数解释:

流水线ID,可以通过查询流水线列表接口获取,其中pipelines.pipelineId即为流水线ID。

约束限制:

不涉及。

取值范围:

32位字符,由数字和字母组成。

默认取值:

不涉及。

pipelineRunId

是

String

流水线运行实例ID,启动流水线接口的返回值即为流水线运行实例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,启动流水线接口的返回值即为流水线运行实例ID。

取值范围:

32位字符,仅由数字和字母组成。

请求示例

POST 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

响应体

错误码

请参见错误码。