Creating a Pipeline Template
Function
Creating a Pipeline Template
URI
POST /v5/{tenant_id}/api/pipeline-templates
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| tenant_id | Yes | String | TenantID |
Request 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). |
| 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. |
| 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
| Parameter | Type | Description |
|---|---|---|
| templateId | String | The template ID. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Error Message |
| error_code | String | Error code. |
Example Requests
POST https://{endpoint}/v5/ce8df55870164338a72d7e828a966a2a/api/pipeline-templates
{
"name" : "Creating a Pipeline Template-20231023215133",
"description" : "",
"language" : "none",
"is_show_source" : true,
"variables" : [ ],
"definition" : "{\"stages\":[{\"name\":\"Phase _1\",\"sequence\":\"0\",\"jobs\":[{\"stage_id\":1698069093677,\"identifier\":\"16980691185419778b0f5-02cd-4bd3-a8cc-da825644add1\",\"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\":\"Java\"},{\"key\":\"module_or_template_id\",\"value\":\"d7dffaefb6d94c63a09cf141668356c7\"}] ,\"business_type\":\"Gate\",\"runtime_attribution\":\"agent\",\"identifier\":\"16980691136015f94b249-102d-44f2-abb5-02fa3ad9fae0\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"completed()\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":0}],\"identifier\":\"16980690936778259e2a5-a97e-4c66-af8d-1908988c1c21\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false}]}",
"domain_id" : "ce8df55870164338a72d7e828a966a2a",
"is_system" : 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.