
# 获取流水线详情 - ShowPipelineDetailV3
#### 功能介绍
获取流水线执行详情
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-pipeline/pipeline_03_0006.html)。
#### URI
GET /v3/pipelines/{pipeline_id}/detail
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| pipeline_id | 是    | String | **参数解释**： 流水线ID，可以通过[查询流水线列表](https://support.huaweicloud.com/api-pipeline/ListPipelines.html)接口，其中pipelines.pipelineId即为流水线ID。 **约束限制**： 不涉及。 **取值范围**： 32位字符，仅由数字和字母组成。 **默认取值**： 不涉及。 |
   
表2Query参数 
| 参数       | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| build_id | 否    | String | **参数解释**： 流水线执行ID。 **约束限制**： 不涉及。 **取值范围**： 不涉及。 **默认取值**： 不涉及。 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| X-Auth-Token | 否    | String | **参数解释**： 用户Token。通过调用[IAM服务获取用户Token接口](https://support.huaweicloud.com/api-iam/iam_30_0003.html)获取（响应消息头中X-Subject-Token的值）。 **约束限制**： 不涉及。 **取值范围**： 不涉及。 **默认取值**： 不涉及。                                                                                                                                                                                                |
| X-Language   | 否    | String | **参数解释**： 语言类型。 **约束限制**： 不涉及。 **取值范围**： - zh-cn：中文。   - en-us：英文。    **默认取值**： en-us。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数       | 参数类型                                                                                        | 描述       |
|:---|:---|:---|
| workflow | [PipelineWorkflowDetail] object     | 流水线工作流详情 |
| states   | Array of [PipelineStateDetail] objects | 流水线阶段信息  |
   
 表5PipelineWorkflowDetail 
| 参数               | 参数类型                                                                                                | 描述                                                                                                                                                   |
|:---|:---|:---|
| pipeline_id      | String                                                                                              | 流水线ID                                                                                                                                                |
| pipeline_name    | String                                                                                              | 流水线名称                                                                                                                                                |
| project_id       | String                                                                                              | 流水线所在的项目ID                                                                                                                                           |
| project_name     | String                                                                                              | 流水线所在的项目名称                                                                                                                                           |
| build_id         | String                                                                                              | 流水线执行ID                                                                                                                                              |
| status           | String                                                                                              | 流水线状态。取值及含义：waiting：等待中；running：运行中；verifying:待审核；suspending：挂起；completed：执行完成                                                                       |
| outcome          | String                                                                                              | 流水线执行结果。取值及含义：success：成功；error：失败；aborted：终止                                                                                                         |
| start_time       | String                                                                                              | 开始执行时间                                                                                                                                               |
| end_time         | String                                                                                              | 执行结束时间                                                                                                                                               |
| elapsed_time     | String                                                                                              | 执行耗时，单位为秒                                                                                                                                            |
| execute_type     | String                                                                                              | 触发方式，取值和含义:MR：仓库mr触发流水线；Push：代码提交触发，CreateTag：仓库创建标签触发；Issue：仓库issue事件触发；Note：仓库note事件触发；Manual：手动触发；Scheduler：定时任务触发；RollBack：回退执行；Unsuspended：解除挂起 |
| executor_id      | String                                                                                              | 执行者ID                                                                                                                                                |
| executor         | String                                                                                              | 执行者                                                                                                                                                  |
| detail_url       | String                                                                                              | 流水线详情链接                                                                                                                                              |
| parameters       | Array of [PipelineParameterDetail] objects | 流水线参数                                                                                                                                                |
| source           | Array of [PipelineSourceDetail] objects       | 代码源信息                                                                                                                                                |
| artifact_sources | Array of [PipelineArtifactDetail] objects   | 制品源信息                                                                                                                                                |
   
 表6PipelineParameterDetail 
| 参数         | 参数类型    | 描述                                                       |
|:---|:---|:---|
| name       | String  | 参数名                                                      |
| value      | String  | 参数值                                                      |
| type       | String  | 参数类型。取值及含义：text：文本；enum：枚举；autoGrowth：自增长；hostGroup：主机组。 |
| is_system  | Boolean | 是否系统参数                                                   |
| is_runtime | Boolean | 是否运行时设置                                                  |
| is_secret  | Boolean | 是否私密参数                                                   |
   
 表7PipelineSourceDetail 
| 参数             | 参数类型                                                                                                  | 描述                                        |
|:---|:---|:---|
| scm_type       | String                                                                                                | 仓库类型，可取值为codehub，gitee，github，general_git |
| endpoint_id    | String                                                                                                | 代码源扩展连接点                                  |
| repo_id        | String                                                                                                | 代码仓ID                                     |
| repo_name      | String                                                                                                | 代码仓名称                                     |
| repo_owner     | String                                                                                                | 所有者                                       |
| display_name   | String                                                                                                | 代码仓对外显示的名称                                |
| git_url        | String                                                                                                | 代码仓地址                                     |
| default_branch | String                                                                                                | 默认分支                                      |
| build_params   | [PipelineSourceBuildParameters] object | 构建参数详情                                    |
   
 表8PipelineSourceBuildParameters 
| 参数            | 参数类型   | 描述                                                                                                                                                   |
|:---|:---|:---|
| tag           | String | 构建tag                                                                                                                                                |
| commit_id     | String | 构建commitId                                                                                                                                           |
| event_type    | String | 触发方式，取值和含义:MR：仓库mr触发流水线；Push：代码提交触发，CreateTag：仓库创建标签触发；Issue：仓库issue事件触发；Note：仓库note事件触发；Manual：手动触发；Scheduler：定时任务触发；RollBack：回退执行；Unsuspended：解除挂起 |
| build_type    | String | 代码仓构建类型，取值及含义：branch：分支；tag：标签。                                                                                                                      |
| message       | String | 代码仓关于本次执行的相关信息                                                                                                                                       |
| action        | String | action                                                                                                                                               |
| merge_id      | String | merge_id                                                                                                                                             |
| source_branch | String | 源分支。非MR触发时，取值为空                                                                                                                                      |
| target_branch | String | 目标分支。非MR触发时，取值为本次执行选择的分支                                                                                                                             |
   
 表9PipelineArtifactDetail 
| 参数                 | 参数类型                                                                                                      | 描述                                 |
|:---|:---|:---|
| source_system      | String                                                                                                    | 流水线源类型，取值为CloudArtifact，表示制品源      |
| artifact_type      | String                                                                                                    | 制品源类型，generic：软件发布库；docker：Docker库 |
| artifact_type_name | String                                                                                                    | 制品源类型名称                            |
| alias              | String                                                                                                    | 部署源别名                              |
| properties         | Object                                                                                                    | 部署源配置                              |
| build_params       | [PipelineArtifactBuildParameters] object | 制品源构建参数                            |
   
 表10PipelineArtifactBuildParameters 
| 参数              | 参数类型   | 描述    |
|:---|:---|:---|
| execute_version | String | 制品源版本 |
   
 表11PipelineStateDetail 
| 参数                  | 参数类型                                                                                      | 描述                                                                            |
|:---|:---|:---|
| id                  | String                                                                                    | 阶段ID                                                                          |
| name                | String                                                                                    | 阶段名称                                                                          |
| type                | String                                                                                    | 节点类型，取值为stage，表示阶段                                                            |
| dsl_method          | String                                                                                    | 阶段类型，如initial，source等                                                         |
| is_manual_execution | Boolean                                                                                   | 是否手动执行                                                                        |
| start_time          | String                                                                                    | 执行开始时间                                                                        |
| end_time            | String                                                                                    | 执行结束时间                                                                        |
| elapsed_time        | String                                                                                    | 执行耗时，单位为秒                                                                     |
| status              | String                                                                                    | 执行状态。取值及含义：waiting：等待中；running：运行中；verifying:待审核；suspending：挂起；completed：执行完成 |
| outcome             | String                                                                                    | 执行结果。取值及含义：success：成功；error：失败；aborted：终止                                     |
| execution_mode      | String                                                                                    | 执行模式。serial：串行；parallel：并行                                                    |
| children            | Array of [PipelineTaskDetail] objects | 阶段下的任务详情信息                                                                    |
   
 表12PipelineTaskDetail 
| 参数                            | 参数类型   | 描述                                                                            |
|:---|:---|:---|
| id                            | String | 任务ID                                                                          |
| name                          | String | 任务名称                                                                          |
| type                          | String | 节点类型,阶段或任务。stage:阶段；task：任务                                                   |
| dsl_method                    | String | 任务类型                                                                          |
| start_time                    | String | 执行开始时间                                                                        |
| end_time                      | String | 执行结束时间                                                                        |
| elapsed_time                  | String | 执行耗时，单位为秒                                                                     |
| status                        | String | 执行状态。取值及含义：waiting：等待中；running：运行中；verifying:待审核；suspending：挂起；completed：执行完成 |
| outcome                       | String | 执行结果。取值及含义：success：成功；error：失败；aborted：终止                                     |
| third_task_id                 | String | 第三方任务ID                                                                       |
| third_task_name               | String | 第三方任务名称                                                                       |
| project_id                    | String | 任务所在的项目ID                                                                     |
| third_task_build_number       | String | 任务构建标识                                                                        |
| third_task_daily_build_number | String | 任务构建标识，仅codeci任务有这个信息                                                         |
| detail_url                    | String | 任务详情链接                                                                        |
| error_code                    | String | 错误码                                                                           |
| error_msg                     | String | 错误信息                                                                          |
   
#### 请求示例
```
GET https://{endpoint}/v3/pipelines/6bcb539a945344249a442e004691eaca/detail
```
#### 响应示例
**状态码：200**
OK
```
{
  "workflow" : {
    "status" : "completed",
    "outcome" : "success",
    "executor" : "beta环境账号",
    "parameter" : [ {
      "name" : "projectId",
      "value" : "3137cc95f7af43ccb41d4f13ffdecea8",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    }, {
      "name" : "buildId",
      "value" : "1",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    }, {
      "name" : "PIPELINE_NUMBER",
      "value" : "1",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    }, {
      "name" : "PIPELINE_ID",
      "value" : "6bcb539a945344249a442e004691eaca",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    }, {
      "name" : "PROJECT_ID",
      "value" : "3137cc95f7af43ccb41d4f13ffdecea8",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    }, {
      "name" : "TIMESTAMP",
      "value" : "20240422115658",
      "type" : "text",
      "is_system" : true,
      "is_runtime" : true,
      "is_secret" : false
    } ],
    "source" : [ {
      "scm_type" : "codehub",
      "endpoint_id" : null,
      "repo_id" : "2111842724",
      "repo_name" : "phoenix-sample",
      "repo_owner" : "",
      "display_name" : "phoenix-sample",
      "git_url" : "git@example.com:3137cc95f7af43ccb41d4f13ffdecea8/phoenix-sample.git",
      "default_branch" : "master",
      "build_params" : {
        "event_type" : "Manual",
        "action" : "",
        "target_branch" : "master",
        "merge_id" : "",
        "tag" : "",
        "message" : "initial commit",
        "build_type" : "branch",
        "commit_id" : "ff413ce20be52732c22509db887a7d2f521c9993",
        "source_branch" : ""
      }
    } ],
    "pipeline_id" : "6bcb539a945344249a442e004691eaca",
    "pipeline_name" : "pipeline-20240422115315",
    "project_id" : "3137cc95f7af43ccb41d4f13ffdecea8",
    "project_name" : "TestInit01",
    "build_id" : "1",
    "start_time" : "1713758218809",
    "end_time" : "1713758219075",
    "elapsed_time" : "0",
    "execute_type" : "Manual",
    "executor_id" : "847a5317086c41798469d0868535943a",
    "executor_user_name" : null,
    "detail_url" : "https://example.com/pipeline/project/3137cc95f7af43ccb41d4f13ffdecea8/pipeline/detail/6bcb539a945344249a442e004691eaca",
    "artifact_sources" : [ ]
  },
  "states" : [ {
    "id" : "state_3",
    "name" : "流水线源",
    "type" : "stage",
    "status" : "completed",
    "outcome" : "success",
    "children" : [ ],
    "dsl_method" : "source",
    "start_time" : "1713758218966",
    "end_time" : "1713758218977",
    "elapsed_time" : "0",
    "execution_mode" : "parallel",
    "is_manual_execution" : false
  }, {
    "id" : "state_4",
    "name" : "构建和检查",
    "type" : "stage",
    "status" : "completed",
    "outcome" : "success",
    "children" : [ ],
    "dsl_method" : "build",
    "start_time" : "1713758218999",
    "end_time" : "1713758219010",
    "elapsed_time" : "0",
    "execution_mode" : "parallel",
    "is_manual_execution" : false
  }, {
    "id" : "final",
    "name" : "结束",
    "type" : "stage",
    "status" : "completed",
    "outcome" : "success",
    "children" : [ ],
    "dsl_method" : "final",
    "start_time" : "1713758219044",
    "end_time" : "1713758219048",
    "elapsed_time" : "0",
    "execution_mode" : "parallel",
    "is_manual_execution" : false
  } ]
}
```
#### 状态码
| 状态码 | 描述           |
|:---|:---|
| 200 | OK           |
| 401 | Unauthorized |
| 403 | Forbidden    |
| 404 | Not Found    |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-pipeline/ErrorCode.html)。
