
# 获取任务各阶段信息 - ShowBuildRecordFullStages
#### 功能介绍
获取任务各阶段信息
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-codeci/cloudbuild_03_0007.html)。
#### 授权信息
当前API调用无需身份策略权限。
#### URI
GET /v1/record/{record_id}/full-stages
表1路径参数 
| 参数        | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| record_id | 是    | String | **参数解释**： 构建记录唯一标识。由ShowJobBuildRecordDetail(获取构建记录信息)接口返回。调用该接口即可获得构建记录ID。 **约束限制**： 不涉及。 **取值范围**： 36位数字、小写字母、'-'组合。 **默认取值**： 不涉及。 |
   
表2Query参数 
| 参数      | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|:---|
| cascade | 否    | Boolean | **参数解释**： 是否联级获取steps。 **约束限制**： 不涉及。 **取值范围**： true\|false。 **默认取值**： false。 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释**： 用户Token。（响应消息头中X-Subject-Token的值）。通过调用IAM服务接口获取，参考[获取IAM用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)。 **约束限制**： 不支持租户全局token，请使用scope为project的region级token。 **取值范围**： 不涉及。 **默认取值**： 不涉及。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数     | 参数类型                                                         | 描述                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| status | String                                                       | **参数解释**： 接口响应状态。 **取值范围**： ● success：表示接口调用成功。 ● fail：表示接口调用失败。 |
| error  | Object                                                       | **参数解释**： 错误信息。 **取值范围**： 不涉及。                                                                                |
| result | [result] object | **参数解释**： 调用接口成功后返回的数据。 **取值范围**： 不涉及。                                                                        |
   
 表5result 
| 参数           | 参数类型                                                                                    | 描述                                                                                                                                                                    |
|:---|:---|:---|
| build_stages | Map\<String,[BuildStageRecord]\> | **参数解释**： 构建步骤。 **取值范围**： 不涉及。 |
   
 表6BuildStageRecord 
| 参数                   | 参数类型                                                                                           | 描述                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| id                   | String                                                                                         | **参数解释**： 步骤编号。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| status               | String                                                                                         | **参数解释**： 步骤状态。 **取值范围**： ● SUCCESS：表示步骤执行成功。 ● FAIL：表示步骤执行失败。                                                                                                                                         |
| status_code          | Integer                                                                                        | **参数解释**： 状态码。 **取值范围**： 不涉及。                                                                                                                                                                                                                       |
| log_status           | String                                                                                         | **参数解释**： 日志状态。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| create_time          | String                                                                                         | **参数解释**： 创建时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| schedule_time        | String                                                                                         | **参数解释**： 构建下发时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                    |
| queued_time          | String                                                                                         | **参数解释**： 构建排队耗时。 **取值范围**： 不涉及。                                                                                                                                                                                                                    |
| start_time           | String                                                                                         | **参数解释**： 开始时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| finish_time          | String                                                                                         | **参数解释**： 结束时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| duration             | Integer                                                                                        | **参数解释**： 构建时长。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| build_duration       | Integer                                                                                        | **参数解释**： 子任务构建耗时。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| pending_duration     | Integer                                                                                        | **参数解释**： 等待时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| build_record_id      | String                                                                                         | **参数解释**： 构建记录ID。 **取值范围**： 不涉及。                                                                                                                                                                                                                    |
| execution_id         | String                                                                                         | **参数解释**： 八爪鱼任务ID。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| execution_stage_name | String                                                                                         | **参数解释**： 步骤名称。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| display_name         | String                                                                                         | **参数解释**： 步骤名称。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| node_id              | Integer                                                                                        | **参数解释**： 节点ID。 **取值范围**： 不涉及。                                                                                                                                                                                                                      |
| sequence             | Integer                                                                                        | **参数解释**： 序号。 **取值范围**： 不涉及。                                                                                                                                                                                                                        |
| steps                | Array of [FullStageStepItems] objects | **参数解释**： 构建执行的步骤。 **约束限制**： 不涉及。 **取值范围**： 不涉及。 **默认取值**： 不涉及。 |
   
 表7FullStageStepItems 
| 参数                  | 参数类型                 | 描述                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| id                  | String               | **参数解释**： 构建任务的ID。 **取值范围**： 不涉及。                                                                                                                                                                                                                |
| status              | String               | **参数解释**： 构建任务执行状态。 **取值范围**： ● SUCCESS：执行成功。 ● FAILURE：执行失败。 ● ABORTED：执行中止。                                                                          |
| status_code         | Integer              | **参数解释**： 构建任务执行状态值。 **取值范围**： 1-8。                                                                                                                                                                                                              |
| duration            | Integer              | **参数解释**： 构建时长。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| create_time         | String               | **参数解释**： 创建时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| schedule_time       | String               | **参数解释**： 构建下发时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| queued_time         | String               | **参数解释**： 构建排队耗时。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| start_time          | String               | **参数解释**： 开始时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| finish_time         | String               | **参数解释**： 结束时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| build_duration      | Integer              | **参数解释**： 子任务构建耗时。 **取值范围**： 不涉及。                                                                                                                                                                                                                |
| pending_duration    | Integer              | **参数解释**： 等待时间。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| build_record_id     | String               | **参数解释**： 构建记录ID。 **取值范围**： 长度为36个字符，可包含小写英文字母、数字和短横线（-）。                                                                                                                                                                                        |
| build_plugin_name   | String               | **参数解释**： 构建插件名称。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| display_name        | String               | **参数解释**： 构建插件别名。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| execution_id        | String               | **参数解释**： octopus任务编号,可提供用于后台日志查询，问题定位。 **取值范围**： 不涉及。                                                                                                                                                                                           |
| execution_step_name | String               | **参数解释**： 构建步骤名称。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| node_id             | String               | **参数解释**： 步骤调度编号。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| sequence            | String               | **参数解释**： 步骤序号。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| stage               | String               | **参数解释**： 构建阶段名称。 **取值范围**： 不涉及。                                                                                                                                                                                                                 |
| remarks             | String               | **参数解释**： 构建阶段。 **取值范围**： 不涉及。                                                                                                                                                                                                                   |
| parameters          | Map\<String,Object\> | **参数解释**： 参数信息。 **约束限制**： 不涉及。 **取值范围**： 不涉及。 **默认取值**： 不涉及。 |
   
#### 请求示例
```
GET https://{endpoint}/v1/record/901878212b1a49be9c1a1054c272762a/full-stages
```
#### 响应示例
**状态码：200**
OK
```
{
  "result" : {
    "build_stages" : {
      "initial" : {
        "id" : "ecc39a5a-aa73-47aa-979d-1d8b8d8a4335",
        "status" : "SUCCESS",
        "status_code" : 5,
        "log_status" : null,
        "create_time" : "2026-03-17T06:35:19.000+00:00",
        "schedule_time" : "2026-03-17T06:35:19.000+00:00",
        "queued_time" : "2026-03-17T06:35:19.000+00:00",
        "start_time" : "2026-03-17T06:35:20.000+00:00",
        "finish_time" : "2026-03-17T06:35:20.000+00:00",
        "duration" : 1005,
        "build_duration" : 5,
        "pending_duration" : 1000,
        "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
        "execution_id" : "j_ZvBBfsZA",
        "execution_stage_name" : "initial",
        "display_name" : "initial",
        "node_id" : 9,
        "sequence" : 0,
        "steps" : [ ]
      },
      "stage1" : {
        "id" : "33c7633d-cdc2-47a2-ac44-f4cff6a5082d",
        "status" : "SUCCESS",
        "status_code" : 5,
        "log_status" : null,
        "create_time" : "2026-03-17T06:35:19.000+00:00",
        "schedule_time" : "2026-03-17T06:35:19.000+00:00",
        "queued_time" : "2026-03-17T06:35:19.000+00:00",
        "start_time" : "2026-03-17T06:35:23.000+00:00",
        "finish_time" : "2026-03-17T06:35:33.000+00:00",
        "duration" : 14493,
        "build_duration" : 10493,
        "pending_duration" : 4000,
        "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
        "execution_id" : "j_ZvBBfsZA",
        "execution_stage_name" : "stage1",
        "display_name" : "代码检出",
        "node_id" : 27,
        "sequence" : 1,
        "steps" : [ {
          "id" : "03530c3c-a3a3-4892-8e85-bd7c4de910c2",
          "status" : "SUCCESS",
          "status_code" : 5,
          "log_status" : null,
          "create_time" : "2026-03-17T06:35:19.000+00:00",
          "schedule_time" : "2026-03-17T06:35:19.000+00:00",
          "queued_time" : "2026-03-17T06:35:19.000+00:00",
          "start_time" : "2026-03-17T06:35:23.000+00:00",
          "finish_time" : "2026-03-17T06:35:23.000+00:00",
          "duration" : 4358,
          "build_duration" : 358,
          "pending_duration" : 4000,
          "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
          "build_plugin_name" : "external_pre_checkout",
          "display_name" : "external_pre_checkout",
          "execution_id" : "j_ZvBBfsZA",
          "execution_step_name" : "external_pre_checkout",
          "node_id" : 28,
          "sequence" : 0,
          "stage" : "stage1",
          "remarks" : "",
          "parameters" : null
        } ]
      },
      "PostBuild" : {
        "id" : "34cc76cb-d00b-48ae-a84b-caa6c773d396",
        "status" : "SUCCESS",
        "status_code" : 5,
        "log_status" : null,
        "create_time" : "2026-03-17T06:35:19.000+00:00",
        "schedule_time" : "2026-03-17T06:35:19.000+00:00",
        "queued_time" : "2026-03-17T06:35:19.000+00:00",
        "start_time" : "2026-03-17T06:36:09.000+00:00",
        "finish_time" : "2026-03-17T06:36:09.000+00:00",
        "duration" : 50062,
        "build_duration" : 62,
        "pending_duration" : 50000,
        "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
        "execution_id" : "j_ZvBBfsZA",
        "execution_stage_name" : "PostBuild",
        "display_name" : "PostBuild",
        "node_id" : 125,
        "sequence" : 5,
        "steps" : [ {
          "id" : "d1ab9228-9cee-4a1d-8766-81774627dbef",
          "status" : "SUCCESS",
          "status_code" : 5,
          "log_status" : null,
          "create_time" : "2026-03-17T06:35:19.000+00:00",
          "schedule_time" : "2026-03-17T06:35:19.000+00:00",
          "queued_time" : "2026-03-17T06:35:19.000+00:00",
          "start_time" : "2026-03-17T06:36:09.000+00:00",
          "finish_time" : "2026-03-17T06:36:09.000+00:00",
          "duration" : 50036,
          "build_duration" : 36,
          "pending_duration" : 50000,
          "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
          "build_plugin_name" : "-",
          "display_name" : "user_properties",
          "execution_id" : "j_ZvBBfsZA",
          "execution_step_name" : "user_properties",
          "node_id" : 126,
          "sequence" : 6,
          "stage" : "PostBuild",
          "remarks" : ""
        } ]
      },
      "final" : {
        "id" : "815e4e4c-f191-44fb-81d9-103ef783c8f9",
        "status" : "SUCCESS",
        "status_code" : 5,
        "log_status" : null,
        "create_time" : "2026-03-17T06:35:19.000+00:00",
        "schedule_time" : "2026-03-17T06:35:19.000+00:00",
        "queued_time" : "2026-03-17T06:35:19.000+00:00",
        "start_time" : "2026-03-17T06:36:11.000+00:00",
        "finish_time" : "2026-03-17T06:36:11.000+00:00",
        "duration" : 52005,
        "build_duration" : 5,
        "pending_duration" : 52000,
        "build_record_id" : "bd99cd13-3a8d-49a3-9703-e89665098a7d",
        "execution_id" : "j_ZvBBfsZA",
        "execution_stage_name" : "final",
        "display_name" : "final",
        "node_id" : 141,
        "sequence" : 6,
        "steps" : [ ]
      }
    },
    "check_stages" : null
  },
  "error" : null,
  "status" : "success"
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  ```
  package com.huaweicloud.sdk.test;
  import com.huaweicloud.sdk.core.auth.ICredential;
  import com.huaweicloud.sdk.core.auth.BasicCredentials;
  import com.huaweicloud.sdk.core.exception.ConnectionException;
  import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
  import com.huaweicloud.sdk.core.exception.ServiceResponseException;
  import com.huaweicloud.sdk.codeartsbuild.v3.region.CodeArtsBuildRegion;
  import com.huaweicloud.sdk.codeartsbuild.v3.*;
  import com.huaweicloud.sdk.codeartsbuild.v3.model.*;
  public class ShowBuildRecordFullStagesSolution {
      public static void main(String[] args) {
          // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
          // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
          String ak = System.getenv("CLOUD_SDK_AK");
          String sk = System.getenv("CLOUD_SDK_SK");
          ICredential auth = new BasicCredentials()
                  .withAk(ak)
                  .withSk(sk);
          CodeArtsBuildClient client = CodeArtsBuildClient.newBuilder()
                  .withCredential(auth)
                  .withRegion(CodeArtsBuildRegion.valueOf("<YOUR REGION>"))
                  .build();
          ShowBuildRecordFullStagesRequest request = new ShowBuildRecordFullStagesRequest();
          request.withRecordId("{record_id}");
          try {
              ShowBuildRecordFullStagesResponse response = client.showBuildRecordFullStages(request);
              System.out.println(response.toString());
          } catch (ConnectionException e) {
              e.printStackTrace();
          } catch (RequestTimeoutException e) {
              e.printStackTrace();
          } catch (ServiceResponseException e) {
              e.printStackTrace();
              System.out.println(e.getHttpStatusCode());
              System.out.println(e.getRequestId());
              System.out.println(e.getErrorCode());
              System.out.println(e.getErrorMsg());
          }
      }
  }
  ```
- [Python]
  ```
  # coding: utf-8
  import os
  from huaweicloudsdkcore.auth.credentials import BasicCredentials
  from huaweicloudsdkcodeartsbuild.v3.region.codeartsbuild_region import CodeArtsBuildRegion
  from huaweicloudsdkcore.exceptions import exceptions
  from huaweicloudsdkcodeartsbuild.v3 import *
  if __name__ == "__main__":
      # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak = os.environ["CLOUD_SDK_AK"]
      sk = os.environ["CLOUD_SDK_SK"]
      credentials = BasicCredentials(ak, sk)
      client = CodeArtsBuildClient.new_builder() \
          .with_credentials(credentials) \
          .with_region(CodeArtsBuildRegion.value_of("<YOUR REGION>")) \
          .build()
      try:
          request = ShowBuildRecordFullStagesRequest()
          request.record_id = "{record_id}"
          response = client.show_build_record_full_stages(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  ```
  package main
  import (
  "fmt"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
      codeartsbuild "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3/model"
      region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3/region"
  )
  func main() {
      // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak := os.Getenv("CLOUD_SDK_AK")
      sk := os.Getenv("CLOUD_SDK_SK")
      auth, err := basic.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := codeartsbuild.CodeArtsBuildClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := codeartsbuild.NewCodeArtsBuildClient(hcClient)
      request := &model.ShowBuildRecordFullStagesRequest{}
  request.RecordId = "{record_id}"
  response, err := client.ShowBuildRecordFullStages(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CodeArtsBuild/sdk?api=ShowBuildRecordFullStages)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-codeci/ErrorCode.html)。
