Use this API to list the statuses recorded against a commit, and to add or update the status that an external CI/CD job reports for a commit.
List all commit statuses
GET /api/v4/projects/{id}/repository/commits/{sha}/statuses
Lists all commit statuses for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
shaPath, | String | Hash of the commit Example: 18f3e63d05582537db6d |
refQuery | String | Name of the branch or tag. Example: develop |
stageQuery | String | Filter statuses by build stage Example: test |
nameQuery | String | Filter statuses by job name Example: bundler: |
pipeline_Query | Integer | Filter statuses by pipeline ID Example: 1234 |
allQuery | Boolean | Include all statuses instead of latest only.false |
order_Query | String | Values for sorting statuses.id and pipeline_.idAllowed values: id,pipeline_Default: id |
sortQuery | String | Sort statuses in ascending or descending order.asc and desc.ascAllowed values: asc,desc |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Create or update a commit pipeline status
POST /api/v4/projects/{id}/statuses/{sha}
Creates or updates the status of a commit represented by a job in an external stage. If the commit is associated with a merge request, target the commit in the merge request source branch.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
shaPath, | String | The commit hash Example: 18f3e63d05582537db6d |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
context | String | A string label to differentiate this status from the status of other systems Example: coverage |
coverage | Number | The total code coverage Example: 100 |
description | String | A short description of the status |
name | String | A string label to differentiate this status from the status of other systems Example: coverage |
pipeline_ | Integer | An existing pipeline ID, |
ref | String | The ref Example: develop |
stateRequired | String | The state of the status Allowed values: pending,running,success,failed,canceled,skippedMinimum length: 1 |
target_ | String | The target URL to associate with this status Example: https: |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Another update to this commit status is in progress | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCommitStatus
| Property | Type | Description |
|---|---|---|
allow_ | Boolean | Example:false |
author | APIEntities | — |
coverage | Number (float) | Example:98. |
created_ | String (date- | Example:2016- |
description | String | — |
finished_ | String (date- | Example:2016- |
id | Integer (int64) | Example:93 |
name | String | Example:default |
pipeline_ | Integer (int64) | Example:101 |
ref | String | Example:develop |
sha | String | Example:18f3e63d05582537db6d |
started_ | String (date- | Example:2016- |
status | String | Example:success |
target_ | String | Example:https: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesUserBasic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | Example:1 |
locked | Boolean | — |
name | String | Example:Administrator |
public_ | String | Example:john@example. |
state | String | Example:active |
username | String | Example:admin |
web_ | String | Example:https: |