Help Center/ CodeArts Pipeline/ API Reference/ API/ Pipeline Management/ Rolling Back the Pipeline Execution
Updated on 2025-09-08 GMT+08:00

Rolling Back the Pipeline Execution

Function

This API is used to roll back the pipeline execution.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

pipeline_id

Yes

String

Definition:

Pipeline ID. Obtain the ID by calling the API for querying pipelines. pipelines.pipelineId indicates the pipeline ID.

Constraints:

N/A

Value range:

The value consists of 32 characters, including digits and letters.

Default value:

N/A

pipelineRunId

Yes

String

Pipeline run ID. The return value of the API for starting a pipeline is the pipeline run ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

sources

Yes

Array of sources objects

Pipeline source.

description

No

String

Pipeline running description.

variables

No

Array of variables objects

Running parameters.

choose_jobs

Yes

Array of strings

Selected running jobs.

choose_stages

Yes

Array of strings

Selected running stages.

Table 3 sources

Parameter

Mandatory

Type

Description

type

Yes

String

Pipeline source type.

params

Yes

params object

Pipeline parameters.

Table 4 params

Parameter

Mandatory

Type

Description

git_type

Yes

String

Git repository type.

codehub_id

Yes

String

Repo repository ID.

default_branch

Yes

String

Default branch.

git_url

Yes

String

URL for downloading a Git repository.

alias

No

String

Repository alias.

endpoint_id

No

String

Endpoint ID.

build_params

Yes

build_params object

Build parameter.

Table 5 build_params

Parameter

Mandatory

Type

Description

build_type

Yes

String

Build type.

event_type

Yes

String

Event type.

target_branch

Yes

String

Target branch.

tag

No

String

Tag name.

Table 6 variables

Parameter

Mandatory

Type

Description

name

No

String

Parameter name.

sequence

No

Integer

Parameter No.

type

No

String

Parameter type.

value

No

String

Parameter value.

is_secret

No

Boolean

Whether the parameter is private or not.

description

No

String

Description.

is_runtime

No

Boolean

Whether the parameter can be set during runtime.

limits

No

Array of strings

Parameter limitations.

is_reset

No

Boolean

Reset or not.

latest_value

No

String

Value of the latest run.

required

No

Boolean

Required or not.

variableGroupName

No

String

Parameter group name.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

pipeline_run_id

String

Definition:

Pipeline run ID. The return value of the API for starting a pipeline is the pipeline run ID.

Value range:

The value consists of 32 characters, including only digits and letters.

Example Requests

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" ]
}

Example Responses

Status code: 200

Response body.

{
  "pipeline_run_id" : "d5e642b122fd453dbaff21d90dee5ac1"
}

Status Codes

Status Code

Description

200

Response body.

Error Codes

See Error Codes.