Updated on 2023-12-08 GMT+08:00

Execute Pipeline

Function

Execute Pipeline

URI

POST /v5/{project_id}/api/pipelines/{pipeline_id}/run

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

pipeline_id

Yes

String

Pipeline ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. Can be obtained by calling the IAM API for obtaining the user token (the value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

sources

No

Array of sources objects

Sources Used

description

No

String

Running Description

variables

No

Array of variables objects

User-defined Parameters

choose_jobs

No

Array of strings

Selected Task

choose_stages

No

Array of strings

Selection Phase

Table 4 sources

Parameter

Mandatory

Type

Description

type

Yes

String

Source Type

params

No

params object

Source Parameter

Table 5 params

Parameter

Mandatory

Type

Description

git_type

Yes

String

Code Repository Type

alias

No

String

Code Repository Alias

codehub_id

No

String

Repo code repository ID

default_branch

No

String

Default Branch

git_url

Yes

String

HTTPS address of the Git repository

endpoint_id

No

String

Extension Point ID

build_params

No

build_params object

Construction Parameters

Table 6 build_params

Parameter

Mandatory

Type

Description

build_type

Yes

String

Indicates whether to trigger a branch or tag.

target_branch

No

String

Running Branch

tag

No

String

Running a Tag

event_type

No

String

Triggering Event Type

Table 7 variables

Parameter

Mandatory

Type

Description

name

Yes

String

Parameter

value

Yes

String

Value

Response Parameters

Status code: 200

Table 8 Response body parameters

Parameter

Type

Description

pipeline_run_id

String

Pipeline running instance ID

Example Requests

Starts a pipeline. The specified branch is master, and the parameter is key:val.

POST https://{endpoint}/v5/54f90b75fc1447b1b65e8d3a9f77923d/api/pipelines/e5460d1d403146a1935c2d4b68ef506c/run

{
  "sources" : [ {
    "type" : "code",
    "params" : {
      "git_type" : "codehub",
      "codehub_id" : "2111699716",
      "default_branch" : "test-lbdsb11",
      "git_url" : "https://example.com/clsyz00001/111.git",
      "build_params" : {
        "build_type" : "branch",
        "event_type" : "Manual",
        "target_branch" : "test-lbdsb11"
      }
    }
  } ],
  "description" : "Running Description",
  "variables" : [ {
    "name" : "key",
    "value" : "val"
  } ],
  "choose_jobs" : [ "16772939480734f4abbc4-b3b9-4235-82c2-46559434cbd4" ]
}

Example Responses

Status code: 200

OK

{
  "pipeline_run_id" : "ad6b7f66283a45be9c1f82b06c831e59"
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.