编辑流水线
功能介绍
此API用于编辑流水线。
URI
PUT /cpepipeline/v2/pipelines/{pipeline_id}
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
pipeline_id | 是 | String | 流水线ID。获取方法,请参考查询流水线列表。 |
请求消息
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
Content-Type | 是 | String | 消息体的类型(格式),默认取值为“application/json;charset=utf8”。 |
X-Auth-Token | 是 | String | 调用接口的认证方式分为Token和AK/SK两种,如果您使用的Token方式,此参数为必填,请填写Token的值。Token获取方式,请参考获取用户Token。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
name | 是 | String | 流水线名称。 |
description | 否 | String | 流水线描述。 |
version | 否 | Integer | 流水线版本。 |
stages | 是 | Array of objects | 阶段,详情请见表表4。 |
environments | 否 | Array of objects | 发布环境,详情请见表表4。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
name | 是 | String | 阶段名称/发布环境名称。 |
approvalType | 是 | Integer | 审批类型。 |
description | 否 | String | 描述。 |
tasks | 是 | Array of objects | 任务,详情请见表表4。 |
参数 | 是否必须 | 参数类型 | 描述 |
|---|---|---|---|
name | 是 | String | 任务名称。 |
displayName | 是 | String | 显示名称 |
input | 否 | Object | 输入参数,详情请见表表5。 |
taskTypeId | 是 | Object | 任务类型参数,详情请见表表6。 |
orderIndex | 否 | Integer | 任务执行顺序。 |
output | 否 | Object | 输出参数。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
assemblingId | 否 | String | 构建任务ID。 |
instanceId | 否 | String | 实例ID。 |
appName | 否 | String | 应用名称。 |
modifiedPath | 否 | String | 修改路径。 |
version | 否 | String | 组件版本 |
参数 | 是否必须 | 参数类型 | 描述 |
|---|---|---|---|
category | 是 | String | 任务目录。 |
owner | 是 | String | 任务所有者。 |
provider | 是 | String | 任务提供方。 |
响应消息
参数 | 参数类型 | 描述 |
|---|---|---|
project | String | 项目名称。 |
domain | String | 租户名称。 |
id | String | 流水线ID。 |
enterpriseProjectId | String | 企业项目ID。 |
modelVersion | Integer | 流水线类型。 |
creator | String | 创建者。 |
revisor | String | 修订者。 |
createdAt | Integer | 创建时间。 |
createdAt | Integer | 修改时间。 |
failMode | String | 激进策略。 |
strategyType | Integer | 触发策略。 |
pipelineDeclaration | Object | 流水线定义,详情请见表表8。 |
参数 | 参数类型 | 描述 |
|---|---|---|
name | String | 流水线名称 |
modelVersion | Integer | 流水线类型。 |
version | Integer | 流水线版本。 |
stages | Array of objects | 流水线阶段,详情请见表表9。 |
configMode | String | 流水线创建类型。 |
参数 | 参数类型 | 描述 |
|---|---|---|
id | String | 阶段ID。 |
name | String | 阶段名称。 |
displayName | String | 阶段显示名称。 |
type | String | 阶段类型。 |
pipelineId | String | 流水线ID。 |
orderIndex | String | 阶段执行顺序。 |
status | Integer | 阶段状态。 |
taskGroup | String | 任务组。 |
tasks | Array of objects | 流水线任务,详情请见表表10。 |
参数 | 参数类型 | 描述 |
|---|---|---|
id | Integer | 任务ID。 |
name | String | 任务名称。 |
displayName | String | 任务显示名称。 |
input | Object | 任务输入参数,详情请见表表5。 |
output | Object | 任务输出参数 |
status | Integer | 任务状态。 |
orderIndex | Integer | 任务执行顺序。 |
skipped | Boolean | 是否跳过。 |
groupIndex | String | 任务所在任务组。 |
delayTime | Integer | 任务延迟执行时间。 |
errorDetails | String | 任务报错信息。 |
stageName | String | 阶段类型。 |
taskTypeId | Object | 任务类型参数,详情请见表表11。 |
参数 | 参数类型 | 描述 |
|---|---|---|
category | String | 任务目录。 |
owner | String | 任务所有者。 |
provider | String | 任务提供方。 |
type | String | 任务类型。 |
参数 | 参数类型 | 描述 |
|---|---|---|
assemblingId | String | 构建任务ID。 |
environment_id | String | 环境ID。 |
请求示例
{
"name": "testzasd",
"description": "",
"version": 2,
"stages": [
{
"name": "Artifacts",
"approvalType": 0,
"tasks": [
{
"name": "ghy-test-comp-0626-3-62e353",
"displayName": "Empty",
"input": {
"assemblingId": "audzvfrtnru94o8jtb9g38svx0rezi86rq43ff8m"
},
"taskTypeId": {
"category": "Build",
"owner": "System",
"provider": "Assembling"
},
"orderIndex": 0
}
]
},
{
"name": "Environments",
"approvalType": 0,
"tasks": [
{
"name": "production",
"displayName": "echotest-nodel",
"orderIndex": 0,
"taskTypeId": {
"category": "Environment",
"owner": "System",
"provider": "Environment"
},
"input": {
"environment_id": "6a67914f-8233-4a62-bd7c-5905bfde5df8"
},
"output": {}
}
]
}
],
"environments": [
{
"name": "production",
"tasks": [
{
"id": 0,
"name": "Deploy",
"display_name": "Deploy",
"task_type_id": {
"category": "Deploy",
"owner": "System",
"provider": "ENV-CAS",
"type": null
},
"input": {
"instanceId": "9c1fa25d-7e5a-4de4-bf3a-516b9650c2a0",
"appName": "ghy-test-0710-1",
"modifiedPath": "{\"ghy-test-0710-1\":\"Artifacts_ghy-test-comp-0626-3-62e353_Output_release@PublishBuildImage\"",
"version": "2025.0710.11520"
},
"output": {},
"status": null,
"order_index": 0,
"skipped": false,
"group_index": null,
"delay_time": 0,
"error_details": null,
"stage_name": null
}
],
"displayName": "echotest-nodel"
}
]
} 响应示例
{
"id": "c5a2abab-6c56-4b04-bb67-92470daef78f",
"modelVersion": 1,
"createdAt": 0,
"updatedAt": 1753103607554,
"strategyType": 0,
"pipelineDeclaration": {
"name": "testzasd",
"description": "",
"modelVersion": 0,
"version": 2,
"stages": [
{
"id": 0,
"name": "Artifacts",
"approvalType": 0,
"displayName": null,
"type": null,
"pipelineId": null,
"orderIndex": 0,
"status": null,
"taskGroup": null,
"tasks": [
{
"id": 0,
"name": "ghy-test-comp-0626-3-62e353",
"displayName": "Empty",
"taskTypeId": {
"category": "Build",
"owner": "System",
"provider": "Assembling",
"type": null
},
"input": {
"assemblingId": "audzvfrtnru94o8jtb9g38svx0rezi86rq43ff8m"
},
"output": {},
"status": null,
"orderIndex": 0,
"skipped": false,
"groupIndex": null,
"delayTime": 0,
"errorDetails": null,
"stageName": null
}
]
},
{
"id": 0,
"name": "Environments",
"approvalType": 0,
"displayName": null,
"type": null,
"pipelineId": null,
"orderIndex": 0,
"status": null,
"taskGroup": null,
"tasks": [
{
"id": 0,
"name": "production",
"displayName": "echotest-nodel",
"taskTypeId": {
"category": "Environment",
"owner": "System",
"provider": "Environment",
"type": null
},
"input": {
"environment_id": "6a67914f-8233-4a62-bd7c-5905bfde5df8"
},
"output": {},
"status": null,
"orderIndex": 0,
"skipped": false,
"groupIndex": null,
"delayTime": 0,
"errorDetails": null,
"stageName": null
}
]
}
],
"environments": [
{
"name": "production",
"tasks": [
{
"id": 0,
"name": "Deploy",
"display_name": "Deploy",
"task_type_id": {
"category": "Deploy",
"owner": "System",
"provider": "ENV-CAS",
"type": null
},
"input": {
"instanceId": "9c1fa25d-7e5a-4de4-bf3a-516b9650c2a0",
"appName": "ghy-test-0710-1",
"modifiedPath": "{\"ghy-test-0710-1\":\"Artifacts_ghy-test-comp-0626-3-62e353_Output_release@PublishBuildImage\"",
"version": "2025.0710.11520"
},
"output": {},
"status": null,
"order_index": 0,
"skipped": false,
"group_index": null,
"delay_time": 0,
"error_details": null,
"stage_name": null
}
]
}
],
"configMode": "ui"
}
} 状态码
状态码 | 描述 |
|---|---|
200 | 操作成功。 |
400 | 错误的请求。 |
404 | 请求对象不存在。 |
500 | 内部错误。 |
错误码
请参考ServiceStage错误码。

