Updated on 2023-11-28 GMT+08:00

Updating a Pipeline Template

Function

Updating a Pipeline Template

URI

PUT /v5/{tenant_id}/api/pipeline-templates/{template_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

tenant_id

Yes

String

Indicates the tenant ID.

template_id

Yes

String

The template 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

name

Yes

String

The template name.

description

No

String

Template description.

language

Yes

String

Language

variables

No

CustomVariable object

User-defined

definition

Yes

String

Template orchestration JSON, including stages

is_system

Yes

Boolean

Indicates whether the template is a system template.

domain_id

Yes

String

Tenant ID.

is_show_source

Yes

Boolean

Indicates whether to display the pipeline source.

Table 4 CustomVariable

Parameter

Mandatory

Type

Description

pipeline_id

No

String

Pipeline ID

name

No

String

Custom Parameter Name

sequence

No

Integer

User-defined Parameter Sequence

type

No

String

Custom Parameter Type

value

No

String

Default values of customized parameters

is_secret

No

Boolean

Indicates whether the parameter is private.

description

No

String

User-defined Parameter Description

is_runtime

No

Boolean

Indicates whether to set during running.

limits

No

Array of objects

Limited

is_reset

No

Boolean

Reset or Not

latest_value

No

String

Latest Parameter Value

runtime_value

No

String

Value Transferred During Running

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

templateId

String

The template ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Error Message

error_code

String

Error code.

Example Requests

PUT https://{endpoint}/v5/ce8df55870164338a72d7e828a966a2a/api/pipeline-templates/ad8a26f8b19a4b83a8d92eb733b65476

{
  "name" : "Creating a Pipeline Template-20231023212159",
  "language" : "none",
  "description" : "",
  "is_system" : false,
  "domain_id" : "ce8df55870164338a72d7e828a966a2a",
  "variables" : [ ],
  "is_show_source" : true,
  "definition" : "{\"stages\":[{\"name\":\"Phase _1\",\"sequence\":\"0\",\"jobs\":[{\"stage_id\":1698067319814,\"identifier\":\"16980673371452673e2a4-b3e1-4389-a145-fc57a4473137\",\"name\":\"CloudBuild Template\",\"depends_on\":[] ,\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\": [{\"name\":\"CloudBuild Template \",\"task\":\"official_devcloud_cloudBuild_template\",\"sequence\":0,\"inputs\":[{\"key\":\"pipelineNumber\",\"value\":\"v1.0.0\"},{\"key\":\"artifactName\",\"value\":\"name\"},{\"key\":\"is_build_in\",\"value\":\"system\"},{\"key\":\"module_or_template_id\",\"value\":\"00057\"}] ,\"business_type\":\"Build\",\"runtime_attribution\":\"agent\",\"identifier\":\"1698067328741629de896-a67b-4c2a-be40-7f6531af2f19\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"completed()\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":0},{\"identifier\":\"1698067635354dba15971-5277-48fe-a219-8cd578aa8773\",\"name\":\"CodeCheck Chinese name \",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\": [{\"name\":\"CodeCheck Chinese name \",\"task\":\"official_devcloud_codeCheck_template\",\"sequence\":0,\"inputs\":[{\"key\":\"language\",\"value\":\"C/C++\"},{\"key\":\"module_or_template_id\",\"value\":\"d7dffaefb6d94c63a09cf141668356c7\"}] ,\"business_type\":\"Gate\",\"runtime_attribution\":\"agent\",\"identifier\":\"1698067631617e1847e52-06ff-429e-9bfa-492ae877f192\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"completed()\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":1}],\"identifier\":\"1698067319814bd28be5a-eb0c-4bdf-9ac5-4b441ef46ef9\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false}]}"
}

Example Responses

Status code: 200

OK

{
  "templateId" : "ad8a26f8b19a4b83a8d92eb733b65476"
}

Status Codes

Status Code

Description

200

OK

400

Bad request

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.