Example 3: Obtain the Pipeline Status
Scenario
This section shows how to obtain a pipeline status by using APIs.
For details about how to call APIs, see Calling APIs.
Constraints
A pipeline task has been created in CodeArts Pipeline.
Involved APIs
Use request parameters such as the user token and pipeline ID to obtain the pipeline status.
Procedure
- Query the pipeline task execution status.
- API information
URI: POST v3/pipelines/{pipeline_id}/status
For details about this API, visit Obtaining the Pipeline Status.
- Example request
GET https://cloudpipeline-ext.ap-southeast-3.myhuaweicloud.com/v3/pipelines/{pipeline_id}/status - Example response
{ "executor": "xxx", "status": "completed", "outcome": "success", "parameters": [ { "name": "serviceName", "value": "Test" }, { "name": "codeBranch", "value": "master" }, { "name": "releaseVersion", "value": "1.0.0" } ], "states": [ { "id": "state_3", "name": "Source code", "type": "stage", "status": "completed", "outcome": "success", "children": [], "start_time": "2020-09-01 17:13:18", "end_time": "2020-09-01 17:13:18", "elapsed_time": "0" }, { "id": "state_4", "name": "Build", "type": "stage", "status": "completed", "outcome": "success", "children": [ { "id": "Task_1", "name": "Default task", "type": "task", "status": "completed", "outcome": "success", "start_time": "2020-09-01 17:13:18", "end_time": "2020-09-01 17:16:22", "elapsed_time": "183", "error_code": null, "error_msg": null, "detail_url": null } ], "start_time": "2020-09-01 17:13:18", "end_time": "2020-09-01 17:16:22", "elapsed_time": "183" }, { "id": "state_5", "name": "Release repo", "type": "stage", "status": "completed", "outcome": "success", "children": [], "start_time": "2020-09-01 17:16:22", "end_time": "2020-09-01 17:16:22", "elapsed_time": "0" } ], "pipeline_id": "824e784b3f43492e99152a4....", "pipeline_name": "pipeline_test", "build_id": "xxxx", "start_time": "2020-09-01 17:13:18", "end_time": "2020-09-01 17:16:22", "elapsed_time": "184", "detail_url": "https://xxxxxx/pipeline/detail/824e784b3f43492e99152a....." }
- API information
What is your overall rating for this page?
Thank 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