Obtaining the Latest Pipeline Associated with a Merge Request
Function
This API is used to obtain the latest pipeline associated with a merge request.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
| Action | Access Level | Resource Type (*: required) | Condition Key | Alias | Dependencies |
|---|---|---|---|---|---|
| codeartsrepo:repository:getRepository | Read | - | - | - | - |
URI
GET https://{hostURL}/v4/repositories/{repository_id}/merge-requests/{merge_request_iid}/actual-head-pipeline
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Definition You can call the API used to query all repositories of the user to query the project list to obtain the repository ID. Constraints N/A Default Value N/A Value range: 1~2147483647 |
| merge_request_iid | Yes | Integer | Definition MR internal ID (IID). Value range: 1~2147483647 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. You can obtain the token 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. Constraints N/A Range A string that can contain 1 to 100,000 characters. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| data | PipelineDetailDto object | Pipeline details |
| is_valid | Boolean | Whether the latest commit has a corresponding pipeline |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Pipeline ID Value range: 1~2147483647 |
| web_url | String | Pipeline link |
| sha | String | commit id |
| ref | String | Branch |
| status | String | Pipeline status. pending: queuing; running: running; success: successful; failed: failed; canceled: canceled; skipped: skipped; and timedout: timed out Enumeration values: |
| created_at | String | Pipeline creation time |
| updated_at | String | Pipeline update time |
| started_at | String | Pipeline start time |
| finished_at | String | Pipeline end time |
| repository_id | Integer | Repository ID Value range: 1~2147483647 |
| is_invalid | Boolean | Whether the pipeline is invalid |
| type | String | Pipeline type. MERGE REQUEST indicates that the pipeline is triggered by an MR Enumeration values: |
| stages | Array of PipelineStageDto objects | Phase information |
| is_latest | Boolean | The latest pipeline or not. |
| trigger_user | String | Triggered user |
| all_job_finished | Boolean | Whether all jobs are complete |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Stage ID Value range: 1~2147483647 |
| repository_id | Integer | Repository ID Value range: 1~2147483647 |
| pipeline_id | Integer | Pipeline ID Value range: 1~2147483647 |
| name | String | Stage name |
| sort_id | Integer | Phase sequence ID Value range: 1~2147483647 |
| status | String | Stage status. pending: queuing; running: running; success: successful; failed: failed; canceled: canceled; skipped: skipped; and timedout: timed out Enumeration values: |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Example Requests
/v4/repositories/2111976239/merge-requests/6/actual-head-pipeline
Example Responses
Status code: 200
OK
{
"is_valid" : true,
"data" : {
"id" : 8125,
"web_url" : "https://example.com/72271b5446614062a01b8be944c9f372/hxb11222/pipelines/8125",
"sha" : "5167228a3d13f9d59f969104c6fc4dbb38f7b5cc",
"ref" : "master",
"status" : "failed",
"created_at" : "2024-12-12T20:47:46.000+08:00",
"updated_at" : "2024-12-12T20:47:47.000+08:00",
"started_at" : "2024-12-12T20:47:47.000+08:00",
"finished_at" : "2024-12-12T20:47:47.000+08:00",
"repository_id" : 2111976239,
"is_invalid" : null,
"type" : "MERGE REQUEST",
"stages" : [ {
"id" : 12625,
"repository_id" : 2111976239,
"pipeline_id" : 8125,
"name" : "CodeArtsCheck",
"sort_id" : null,
"status" : "failed"
} ],
"is_latest" : true,
"trigger_user" : null,
"all_job_finished" : true
}
} Status code: 401
Unauthorized
{
"error_code" : "CH.00000002",
"error_msg" : "Recognize authentication information failed."
} Status code: 404
Not Found
{
"error_code" : "CH.00402000",
"error_msg" : "The repository does not exist. Check and try again."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Unauthorized |
| 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