Example 1: Executing a Build Task and Checking Its Status
Scenario
This section describes how to use APIs to execute a build task and check whether the task is running.
For details about how to call APIs, see Calling APIs.
Constraints
The build task to execute has already been created in CodeArts Build.
Involved APIs
Use the API designed to execute a build task by providing key request parameters, such as the user token and the task ID. Additionally, leverage the API that monitors task progress to check the task status using the task ID. Here is how you can use these APIs:
- Run the build task. (For details, see Running a Build Task.)
- Check the task status. (For details, see Checking Task Running Status.)
Procedure
- Run a build task.
- API information
For details about the API, see Running a Build Task.
- Example request
POST https://cloudbuild-ext.ap-southeast-3.myhuaweicloud.com/v3/jobs/build
- Example request body
{ "job_id": "3341eaf0de6844669f07baa1ddfc9..." }
- Example response
{ "octopus_job_name": "j_WfRE6eOY", "actual_build_number": "55", "daily_build_number": "20200825.1" }
- API information
- Check whether the task is running.
- API information
URI: GET /v3/jobs/{job_id}/status
For details about the API, see Checking Task Running Status.
- Example request
GET https://cloudbuild-ext.ap-southeast-3.myhuaweicloud.com/v3/jobs/3341eaf0de6844669f07bdfc9.../status
- Example response
{ "result": false }
- API information
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