Obtaining Pipeline List/Pipeline Execution Status in a Project
Function
This API is used to obtain pipeline list and pipeline execution status in a project.
Calling Method
For details, see Calling APIs.
URI
POST /v5/{project_id}/api/pipelines/list
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
Request 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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_ids |
No |
Array of strings |
Project IDs. |
component_id |
No |
String |
Component ID. |
name |
No |
String |
Pipeline name. Fuzzy search is supported. |
status |
No |
Array of strings |
Status. |
is_publish |
No |
Boolean |
Whether the pipeline is a change pipeline. |
creator_ids |
No |
Array of strings |
Creator IDs. |
executor_ids |
No |
Array of strings |
Executor IDs. |
start_time |
No |
String |
Start time. |
end_time |
No |
String |
End time. |
offset |
No |
Long |
Initial offset. |
limit |
No |
Long |
Number of queried records. |
sort_key |
No |
String |
Sorting field name. |
sort_dir |
No |
String |
Sorting rule. |
group_path_id |
No |
String |
Pipeline group ID. |
by_group |
No |
Boolean |
Whether to query by group. |
query_new |
No |
Boolean |
Whether to query only the new-version pipelines. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
offset |
Integer |
Initial offset. |
limit |
Integer |
Query size. |
total |
Integer |
Total number. |
pipelines |
Array of pipelines objects |
Pipeline. |
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Pipeline ID. |
name |
String |
Pipeline name. |
project_id |
String |
Project ID. |
project_name |
String |
Project name. |
component_id |
String |
Component ID. |
is_publish |
Boolean |
Whether the pipeline is a change pipeline. |
is_collect |
Boolean |
Whether to follow the pipeline. |
manifest_version |
String |
Pipeline version. |
create_time |
Long |
Creation time. |
latest_run |
latest_run object |
Latest execution information. |
convert_sign |
Integer |
Flag of switching from old version to new version. |
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Pipeline ID. |
pipeline_run_id |
String |
Pipeline run ID. |
executor_id |
String |
Executor ID. |
executor_name |
String |
Executor name. |
stage_status_list |
Array of stage_status_list objects |
Stage information list. |
status |
String |
Status. |
run_number |
Integer |
Running number. |
trigger_type |
String |
Trigger type. |
build_params |
build_params object |
Build parameters. |
artifact_params |
artifact_params object |
Artifact source parameters. |
start_time |
Long |
Start time. |
end_time |
Long |
End time. |
modify_url |
String |
Address of the change page. |
detail_url |
String |
Address of the details page. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Stage name. |
sequence |
Integer |
Serial number. |
status |
String |
Status. |
start_time |
String |
Start time. |
end_time |
String |
End time. |
id |
String |
Stage ID. |
Parameter |
Type |
Description |
---|---|---|
action |
String |
Event type of the merge request. |
build_type |
String |
Run by branch or by tag. |
commit_id |
String |
Code repository commit ID. |
event_type |
String |
Event type for running. |
merge_id |
String |
Merge request ID. |
message |
String |
Code commit message. |
source_branch |
String |
Source branch. |
tag |
String |
Tag. |
target_branch |
String |
Target branch. |
codehub_id |
String |
Repo repository ID. |
git_url |
String |
HTTPS address of the code repository. |
source_codehub_id |
String |
Source Repo repository ID. |
source_codehub_url |
String |
Source Repo repository address. |
source_codehub_http_url |
String |
HTTP address of the source Repo repository. |
Example Requests
This API is used to obtain the pipeline list. Set the start offset to 0 and the number to 10.
POST https://{endpoint}/v5/54f90b75fc1447b1b65e8d3a9f77923d/api/pipelines/list { "offset" : 0, "limit" : 10, "name" : "" }
Example Responses
Status code: 200
OK
{ "offset" : 0, "limit" : 10, "total" : 1, "pipelines" : [ { "pipeline_id" : "cd65d6f2dc17493e97eb5175f872761a", "name" : "New Pipeline - 20230222181032", "project_id" : "6428c2e2b4b64affa14ec80896695c49", "component_id" : "7bb171e9e9fc415dbd1666ceb68668da", "is_publish" : true, "is_collect" : false, "manifest_version" : "3.0", "create_time" : 1677060662000, "latest_run" : { "pipeline_id" : "cd65d6f2dc17493e97eb5175f872761a", "pipeline_run_id" : "88a195482b8a48a1808e87ec21565c2f", "executor_id" : "847a5317086c41798469d0868535943a", "executor_name" : "Beta environment account", "stage_status_list" : [ { "name" : "Merge Integration Branch", "sequence" : 0, "status" : "FAILED", "start_time" : "2023-02-22 18:12:25", "end_time" : "2023-02-22 18:12:32" }, { "name" : "Phase_1", "sequence" : 1, "status" : "INIT", "start_time" : null, "end_time" : null }, { "name" : "Combining Trunks", "sequence" : 1, "status" : "INIT", "start_time" : null, "end_time" : null } ], "status" : "FAILED", "run_number" : 1, "trigger_type" : "Manual", "build_params" : null, "artifact_params" : null, "start_time" : 1677060745000, "end_time" : 1677060752000 } } ] }
SDK Sample Code
The SDK sample code is as follows.
This API is used to obtain the pipeline list. Set the start offset to 0 and the number to 10.
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 46 47 48 49 50 |
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 ListPipelinesSolution { 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(); ListPipelinesRequest request = new ListPipelinesRequest(); ListPipelineQuery body = new ListPipelineQuery(); body.withLimit(10L); body.withOffset(0L); body.withName(""); request.withBody(body); try { ListPipelinesResponse response = client.listPipelines(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()); } } } |
This API is used to obtain the pipeline list. Set the start offset to 0 and the number to 10.
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 |
# 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 = ListPipelinesRequest() request.body = ListPipelineQuery( limit=10, offset=0, name="" ) response = client.list_pipelines(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
This API is used to obtain the pipeline list. Set the start offset to 0 and the number to 10.
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 |
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.ListPipelinesRequest{} limitListPipelineQuery:= int64(10) offsetListPipelineQuery:= int64(0) nameListPipelineQuery:= "" request.Body = &model.ListPipelineQuery{ Limit: &limitListPipelineQuery, Offset: &offsetListPipelineQuery, Name: &nameListPipelineQuery, } response, err := client.ListPipelines(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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot