CreatePipelineRun - Run a pipeline

Updated at:

Triggers a pipeline run through the OpenAPI.

Applicable editions

Central edition, Region edition

Endpoints and authorization information

  • Obtain an endpoint: Replace {domain} in the API request syntax.

  • Obtain a personal access token.

  • Obtain the organizationId: Required only for the Central edition. Go to the Basic Information page in the Tenant Management console to obtain the organization ID.

Product

Resource

Required permission

Pipeline

Pipeline running instance

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/flow/organizations/{organizationId}/pipelines/{pipelineId}/runs

Region edition

POST https://{domain}/oapi/v1/flow/pipelines/{pipelineId}/runs

Request headers

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

Your personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Position

Required

Description

Example

organizationId

string

path

  • Yes: For the Central edition

  • No: For the Region edition

The organization ID.

5ebbc0228123212b59xxxxx

pipelineId

string

path

Yes

The pipeline ID.

123

-

object

body

No

params

string

body

No

A JSON string of pipeline run parameters, including `branchModeBranchs` (branches in branch mode), `envs` (environment variables), `runningBranchs` (branches keyed by repository URL), and `runningTags` (tags keyed by repository URL).

{ "branchModeBranchs": ["branch1", "branch2"], "envs": { "k1": "v1", "k2": "v2", "k3": "v3" }, "runningBranchs": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "master1" }, "runningTags": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "1.0" }, "runningPipelineArtifacts": { "3184679": "12" }, "runningAcrArtifacts": { "yunxiao-registry.cn-beijing.cr.aliyuncs.com/build-steps/tool-registry": "89b20155-2024-05-14-21-52-44" }, "runningPackagesArtifacts": { "generic/flow_generic_repo/Artifacts_3183732": "2024-06-04-17-58-34" }, "comment":"222" }

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/pipelines/123/runs' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "params": "{ "branchModeBranchs": ["branch1", "branch2"], "envs": { "k1": "v1", "k2": "v2", "k3": "v3" }, "runningBranchs": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "master1" }, "runningTags": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "1.0" }, "runningPipelineArtifacts": { "3184679": "12" }, "runningAcrArtifacts": { "yunxiao-registry.cn-beijing.cr.aliyuncs.com/build-steps/tool-registry": "89b20155-2024-05-14-21-52-44" }, "runningPackagesArtifacts": { "generic/flow_generic_repo/Artifacts_3183732": "2024-06-04-17-58-34" }, "comment":"222" }"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/flow/pipelines/123/runs' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "params": "{ "branchModeBranchs": ["branch1", "branch2"], "envs": { "k1": "v1", "k2": "v2", "k3": "v3" }, "runningBranchs": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "master1" }, "runningTags": { "https://codeup.aliyun.com/60c1abb32c5969c370c5fcd0/Codeup-Demo.git": "1.0" }, "runningPipelineArtifacts": { "3184679": "12" }, "runningAcrArtifacts": { "yunxiao-registry.cn-beijing.cr.aliyuncs.com/build-steps/tool-registry": "89b20155-2024-05-14-21-52-44" }, "runningPackagesArtifacts": { "generic/flow_generic_repo/Artifacts_3183732": "2024-06-04-17-58-34" }, "comment":"222" }"
    }'

Response parameters

Parameter

Type

Description

Example

-

integer

The pipeline run ID, which also indicates the total number of times the pipeline has been run.

1

Response example

1

Error codes

For API error codes, see Error Code Center.