Obtaining Pipeline Statuses in Batches
Function
This API is used to obtain pipeline status in batches. Only the data with execution records is returned.
Calling Method
For details, see Calling APIs.
URI
POST /v5/{project_id}/api/pipelines/status
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Parameter description: CodeArts project ID. Constraints: N/A. Value Range: The value contains 32 characters. Default value: N/A. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Parameter description: User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. Constraints: None. Value range: None. Default value: None. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
[items] |
Yes |
Array of strings |
Parameter description: Pipeline ID list. Value range: Each ID contains 32 characters, including only letters and digits. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
[items] |
Array of PipelineLatestRun objects |
Pipeline and its last execution information. |
Parameter |
Type |
Description |
---|---|---|
pipeline_id |
String |
Parameter description: Pipeline ID. Value range: 32 characters, including only digits and letters. |
pipeline_run_id |
String |
Parameter description: Pipeline run ID. Value range: 32 characters, including only digits and letters. |
executor_id |
String |
Parameter description: Executor ID. Value range: 32 characters, including only digits and letters. |
executor_name |
String |
Parameter description: Executor name. Value range: None. |
stage_status_list |
Array of stage_status_list objects |
Parameter description: Stage status information, including the detailed status information of each stage. Constraints: N/A |
status |
String |
Parameter description: Pipeline run status. Value Range: COMPLETED: completed; RUNNING: running; FAILED: failed; CANCELED: canceled; PAUSED: paused; SUSPEND: suspended; IGNORED: ignored. |
run_number |
Integer |
Parameter description: Pipeline running sequence number. Value range: No less than 1. |
trigger_type |
String |
Parameter description: Trigger type. Value Range: Manual: manual trigger; Scheduler: scheduled task; RollBack: rollback execution; Webhook type: CreateTag: tag trigger; Note: Gitee repository comment trigger; Issue: Gitee repository issue trigger; MR: merge request trigger; Push: code push trigger. |
build_params |
build_params object |
Parameter description: Build parameters. Value range: None. |
artifact_params |
artifact_params object |
Parameter description: Artifact parameters. Value range: None. |
start_time |
Long |
Parameter description: Start time. Value range: None. |
end_time |
Long |
Parameter description: End time. Value range: None. |
modify_url |
String |
Parameter description: Address of the editing page. Value range: None. |
detail_url |
String |
Parameter description: Address of the details page. Value range: None. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Parameter description: Stage name. Value range: Enter only letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), parentheses (), and spaces. The value cannot start or end with a space, and the length is 1128 characters. |
sequence |
Integer |
Parameter description: Stage sequence number. The value 0 indicates the first pipeline stage. Value range: No less than 0. |
status |
String |
Parameter description: Pipeline stage status. Value Range: INIT: initialization; QUEUED: queuing; RUNNING: running; CANCELED: canceled; COMPLETED: completed; FAILED: failed; SKIPPED: skipped; IGNORED: ignored; PAUSED: paused, SUSPEND: suspended; ASYNC_RUNNING: asynchronous running; ASYNC_FAILED: asynchronous failure; UNSELECTED: not selected; REDISPATCH: rescheduling. |
start_time |
String |
Parameter description: Stage start time. Value range: None. |
end_time |
String |
Parameter description: Stage end time. Value range: None. |
Parameter |
Type |
Description |
---|---|---|
action |
String |
Parameter description: Merge request event type. Value range: The value can be open, reopen, update, or merge. |
build_type |
String |
Parameter description: Whether to trigger by branch or tag. Value range: branch: triggered by a branch; tag: triggered by a tag. |
commit_id |
String |
Parameter description: Code repository commit ID. Value range: None. |
event_type |
String |
Parameter description: Event type for execution. Value range: Manual: manual trigger; Scheduler: scheduled task; Rollback: rollback execution; Webhook, which includes: CreateTag: tag trigger; Note: Gitee repository comment; Issue: Gitee repository issue; MR: merge request; Push: code push. |
merge_id |
String |
Parameter description: Merge request ID. Value range: None. |
message |
String |
Parameter description: Code commit message. Value range: None. |
source_branch |
String |
Parameter description: Source branch. Value range: None. |
tag |
String |
Parameter description: Tag. Value range: None. |
target_branch |
String |
Parameter description: Target branch. Value range: None. |
codehub_id |
String |
Parameter description: Repo code repository ID. Value range: None. |
git_url |
String |
Parameter description: HTTPS address of the code repository. Value range: None. |
source_codehub_id |
String |
Parameter description: ID of the source Repo code repository. Value range: None. |
source_codehub_url |
String |
Parameter description: Address of the source Repo code repository. Value range: None. |
source_codehub_http_url |
String |
Parameter description: HTTP address of the source Repo code repository. Value range: None. |
Parameter |
Type |
Description |
---|---|---|
version |
String |
Parameter description: Package version. Value range: None. |
branch_filter |
String |
Parameter description: Branch filter. Value range: None. |
package_name |
String |
Parameter description: Package name. Value range: None. |
organization |
String |
Parameter description: Docker organization. Value range: None. |
Example Requests
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
POST https://{endpoint}/v5/54f90b75fc1447b1b65e8d3a9f77923d/api/pipelines/status
[ "d19799d619424b2bb2625ec2d93ea087" ]
Example Responses
Status code: 200
OK
[ {
"pipeline_id" : "d19799d619424b2bb2625ec2d93ea087",
"pipeline_run_id" : "ad6b7f66283a45be9c1f82b06c831e59",
"executor_id" : "847a5317086c41798469d0868535943a",
"executor_name" : "Beta environment account",
"stage_status_list" : [ {
"name" : "Phase_1",
"sequence" : 0,
"status" : "FAILED",
"start_time" : "2023-03-04 16:48:09",
"end_time" : "2023-03-04 16:50:11"
} ],
"status" : "FAILED",
"run_number" : 2,
"trigger_type" : "Manual",
"build_params" : {
"action" : null,
"build_type" : "branch",
"commit_id" : "fc93c34f906aeb1cc031e3f6f8b2baeac078ae4b",
"event_type" : "Manual",
"merge_id" : null,
"message" : "init",
"source_branch" : null,
"tag" : null,
"target_branch" : "test-lbdsb11",
"codehub_id" : "2111699716",
"git_url" : "https://example.com/clsyz00001/111.git"
},
"artifact_params" : null,
"start_time" : 1677919688000,
"end_time" : 1677919811000
} ]
SDK Sample Code
The SDK sample code is as follows.
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 51 |
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.*;
import java.util.List;
import java.util.ArrayList;
public class BatchShowPipelinesLatestStatusSolution {
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();
BatchShowPipelinesLatestStatusRequest request = new BatchShowPipelinesLatestStatusRequest();
request.withProjectId("{project_id}");
List<String> listbodyBody = new ArrayList<>();
listbodyBody.add("d19799d619424b2bb2625ec2d93ea087");
request.withBody(listbodyBody);
try {
BatchShowPipelinesLatestStatusResponse response = client.batchShowPipelinesLatestStatus(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());
}
}
}
|
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 = BatchShowPipelinesLatestStatusRequest()
request.project_id = "{project_id}"
listBodybody = [
"d19799d619424b2bb2625ec2d93ea087"
]
request.body = listBodybody
response = client.batch_show_pipelines_latest_status(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
|
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 |
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.BatchShowPipelinesLatestStatusRequest{}
request.ProjectId = "{project_id}"
var listBodybody = []string{
"d19799d619424b2bb2625ec2d93ea087",
}
request.Body = &listBodybody
response, err := client.BatchShowPipelinesLatestStatus(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.
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 51 |
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.*;
import java.util.List;
import java.util.ArrayList;
public class BatchShowPipelinesLatestStatusSolution {
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();
BatchShowPipelinesLatestStatusRequest request = new BatchShowPipelinesLatestStatusRequest();
request.withProjectId("{project_id}");
List<String> listbodyBody = new ArrayList<>();
listbodyBody.add("d19799d619424b2bb2625ec2d93ea087");
request.withBody(listbodyBody);
try {
BatchShowPipelinesLatestStatusResponse response = client.batchShowPipelinesLatestStatus(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());
}
}
}
|
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 = BatchShowPipelinesLatestStatusRequest()
request.project_id = "{project_id}"
listBodybody = [
"d19799d619424b2bb2625ec2d93ea087"
]
request.body = listBodybody
response = client.batch_show_pipelines_latest_status(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
|
Obtaining Pipeline Statuses in Batches
The pipeline ID is d19799d619424b2bb2625ec2d93ea087.
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 |
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.BatchShowPipelinesLatestStatusRequest{}
request.ProjectId = "{project_id}"
var listBodybody = []string{
"d19799d619424b2bb2625ec2d93ea087",
}
request.Body = &listBodybody
response, err := client.BatchShowPipelinesLatestStatus(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