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 | Commit SHA Example: 18f3e63d05582537db6d |
refQuery | String | Name of the branch or tag. Example: develop |
stageQuery | String | Filter statuses by build stage.testExample: test |
nameQuery | String | Filter statuses by job name Example: bundler: |
pipeline_Query | Integer | Filter statuses by pipeline ID. Example: 1234 |
allQuery | Boolean | If true, |
order_Query | String | Sort results by the specified field.pipeline_,id in the sort direction.Allowed values: id,pipeline_Default: id |
sortQuery | String | Sort statuses in ascending or descending order.asc.Allowed values: asc,desc |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of 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. The job is added to the newest matching pipeline for the commit. If no matching pipeline exists, a new pipeline is created with CI_PIPELINE_SOURCE: external. When duplicate pipelines exist for the same commit, the newest one receives the status. If the matching pipeline exceeds the maximum number of jobs in a pipeline, a 422 error is returned when pipeline_id is specified. Otherwise, a new pipeline is created. If an update is already in progress for the same SHA and ref, a 409 error is returned, and the request can be retried.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
shaPath, | String | Commit SHA Example: 18f3e63d05582537db6d |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
context | String | String label to differentiate this status from the status of other systems.defaultExample: coverage |
coverage | Number | Total code coverage Example: 100 |
description | String | Short description of the status. |
name | String | String label to differentiate this status from the status of other systems.defaultExample: coverage |
pipeline_ | Integer | ID of the pipeline to set the status for. |
ref | String | Branch or tag that the status refers to. Example: develop |
stateRequired | String | State of the status Allowed values: pending,running,success,failed,canceled,skippedMinimum length: 1 |
target_ | String | 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 | If true,Example: false |
author | APIEntities | User who created the status |
coverage | Number (float) | Code coverage percentage Example: 98. |
created_ | String (date- | Date and time when the status was created Example: 2016- |
description | String | Description of the status |
finished_ | String (date- | Date and time when the status finished Example: 2016- |
id | Integer (int64) | ID of the status Example: 93 |
name | String | Name of the status Example: default |
pipeline_ | Integer (int64) | Example:101 |
ref | String | Branch or tag of the commit Example: develop |
sha | String | SHA of the commit Example: 18f3e63d05582537db6d |
started_ | String (date- | Date and time when the status started Example: 2016- |
status | String | Status of the commit Example: success |
target_ | String | Target URL associated with the status Example: https: |
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesUserBasic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | URL of the user’s avatar Example: https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | ID of the user Example: 1 |
locked | Boolean | If true, |
name | String | Name of the user.**** if the current user cannot read the bot’s project or groupExample: Administrator |
public_ | String | Public email address of the user Example: john@example. |
state | String | State of the user account.active,blocked,ldap_,blocked_,banned,deactivatedExample: active |
username | String | Username of the user Example: admin |
web_ | String | URL of the user’s profile Example: https: |