Updated on 2024-06-14 GMT+08:00

Querying Pipeline Details

Function

Querying Pipeline Details

Calling Method

For details, see Calling APIs.

URI

GET /v5/{project_id}/api/pipelines/{pipeline_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

pipeline_id

Yes

String

Pipeline ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Pipeline ID

name

String

Pipeline name

description

String

Description

manifest_version

String

Pipeline version.

region

String

Site

domain_id

String

Tenant ID.

project_id

String

Project ID

component_id

String

Indicates the microservice ID.

is_publish

Boolean

Indicates whether the pipeline is a change pipeline.

creator_id

String

Creator ID.

creator_name

String

Creator name

updater_id

String

Updater ID

create_time

Long

Updated by

update_time

Long

Updated

is_collect

Boolean

Indicates whether the content is added to favorites by the current user.

sources

Array of PipelineSource objects

Pipeline Source

variables

Array of PipelineVariable objects

Customized pipeline parameters

schedules

Array of PipelineSchedule objects

Pipeline Scheduled Task Settings

triggers

Array of PipelineTrigger objects

Pipeline Event Triggering Settings

group_id

String

ID of the group to which the pipeline belongs.

definition

String

Define a pipeline

Table 4 PipelineSource

Parameter

Type

Description

type

String

Pipeline Source Type

params

PipelineSourceParam object

Pipeline Source Parameters

Table 5 PipelineSourceParam

Parameter

Type

Description

alias

String

Code/Artifact source parameter: alias of the code repository/artifact source. The alias can contain a maximum of 128 characters, including uppercase letters, lowercase letters, digits, and underscores (_).

git_type

String

Code source parameter - Git Type

codehub_id

String

Code source parameter - Repo code repository ID

endpoint_id

String

Code source parameter - Endpoint ID

default_branch

String

Code source parameters - Default Branch

git_url

String

Code source parameters - Git Link

ssh_git_url

String

Code source parameters - ssh_git Link

web_url

String

Code source parameter - Web Page URL

repo_name

String

Code source parameter - Pipeline source name

artifact_type

String

Artifact source parameter - Artifact source type. The options are generic and docker.

artifact_type_name

String

Artifact source parameter - Artifact source type name

branch_filter

String

Artifact source parameter - Filter Branch

directory

String

Artifact source parameter - Directory

directory_id

String

Artifact source parameter - Directory ID

organization

String

Artifact source parameters - Docker Organization

package_name

String

Artifact source parameter - Package name

version

String

Artifact source parameter - Version

version_strategy

String

Artifact source parameter - Policy for obtaining the artifact source version. The value can be latest or specificVersion.

source_system

String

Artifact source parameter - Artifact source name

Table 6 PipelineVariable

Parameter

Type

Description

name

String

Parameter

sequence

Integer

No.

type

String

Type

value

String

Default Value

is_secret

Boolean

Private or Not

description

String

Description

is_runtime

Boolean

Indicates whether to set during running.

limits

Array of strings

Enumerated Value

is_reset

Boolean

Whether the auto-increment parameter is reset

latest_value

String

Latest value of the auto-increment parameter

Table 7 PipelineSchedule

Parameter

Type

Description

uuid

String

Job ID.

type

String

Job type.

name

String

Job name.

enable

String

Available or not.

days_of_week

Array of integers

Specific time in one week.

time_zone

String

Time zone.

Table 8 PipelineTrigger

Parameter

Type

Description

pipeline_id

String

Pipeline ID.

git_url

String

Git URL.

git_type

String

Git type.

is_auto_commit

Boolean

Whether to automatically commit.

events

Array of CodeEvent objects

Event.

hook_id

String

Callback ID.

repo_id

String

Repository ID.

endpoint_id

String

Endpoint ID.

callback_url

String

Callback URL.

security_token

String

User token.

Table 9 CodeEvent

Parameter

Type

Description

type

String

Event type.

enable

Boolean

Available or not.

Example Requests

GET https://{endpoint}/v5/6428c2e2b4b64affa14ec80896695c49/api/pipelines/633839ac12a2465ba86dfc5cd212ee1a

Example Responses

Status code: 200

OK

{
  "id" : "9777b6f14dca47ab8e411512b8301698",
  "name" : "New Pipeline - 20230222110358",
  "description" : "",
  "manifest_version" : "3.0",
  "region" : "region",
  "domain_id" : "ce8df55870164338a72d7e828a966a2a",
  "project_id" : "f83ef803e04e4fe8834ddaf18ffd9d8f",
  "component_id" : "",
  "is_publish" : false,
  "creator_id" : "847a5317086c41798469d0868535943a",
  "creator_name" : "Beta environment account",
  "updater_id" : "847a5317086c41798469d0868535943a",
  "create_time" : 1676116509000,
  "update_time" : 1690785914000,
  "is_collect" : true,
  "sources" : [ ],
  "variables" : [ ],
  "schedules" : [ {
    "uuid" : "38e10252a4ea48c594f744bb4fc1411c",
    "type" : "fixed",
    "name" : "Scheduled task_1",
    "enable" : true,
    "days_of_week" : [ 2, 3, 4, 5, 6 ],
    "time_zone" : "China Standard Time"
  } ],
  "triggers" : [ ],
  "group_id" : null,
  "definition" : "{\"stages\":[{\"name\":\"Delayed execution of phase _1\",\"sequence\":\"0\",\"jobs\":[{\"id\":\"\",\"stage_id\":1677035050256,\"identifier\":\"167703505025720bcc960-2929-457f-91e5-9099556cc478\",\"name\": \"\",\"depends_on\":[] ,\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\": [{\"name\":\"Delayed execution of \",\"task\":\"official_devcloud_delay\",\"sequence\":0,\"inputs\":[{\"key\":\"timer_type\",\"value\":\"delay\"},{\"key\":\"delay_time\",\"value\":10},{\"key\":\"scheduled_time\",\"value\":\"\"},{\"key\":\"time_zone\",\"value\":\"China Standard Time\"}] ,\"business_type\":\"Normal\",\"runtime_attribution\":\"agentless\",\"identifier\":\"1677035056887f508df54-eff9-4f47-b67d-0629917599e9\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.3\"}],\"exec_type\":\"AGENTLESS_JOB\",\"sequence\":0,\"pipeline_id\":\"62bc8c36ab1a4ef9831df98e88c33c69\"}],\"identifier\":\"0\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false,\"pipeline_id\":\"62bc8c36ab1a4ef9831df98e88c33c69\"}]}"
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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.codeartspipeline.v2.region.CodeArtsPipelineRegion;
import com.huaweicloud.sdk.codeartspipeline.v2.*;
import com.huaweicloud.sdk.codeartspipeline.v2.model.*;


public class ShowPipelineDetailSolution {

    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);

        CodeArtsPipelineClient client = CodeArtsPipelineClient.newBuilder()
                .withCredential(auth)
                .withRegion(CodeArtsPipelineRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowPipelineDetailRequest request = new ShowPipelineDetailRequest();
        try {
            ShowPipelineDetailResponse response = client.showPipelineDetail(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());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcodeartspipeline.v2.region.codeartspipeline_region import CodeArtsPipelineRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcodeartspipeline.v2 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 = CodeArtsPipelineClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CodeArtsPipelineRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowPipelineDetailRequest()
        response = client.show_pipeline_detail(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    codeartspipeline "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/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 := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := codeartspipeline.NewCodeArtsPipelineClient(
        codeartspipeline.CodeArtsPipelineClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowPipelineDetailRequest{}
	response, err := client.ShowPipelineDetail(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.