Commit aad2d3f5 authored by Marius Bobin's avatar Marius Bobin

Merge branch 'add-iid-to-pipelines-api' into 'master'

Expose iid in pipelines api

See merge request gitlab-org/gitlab!76625
parents 1d68034f a7f53bdd
......@@ -15,6 +15,8 @@ Read more on [pagination](index.md#pagination).
## List project pipelines
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
List pipelines in a project. Child pipelines are not included in the results,
but you can [get child pipeline](pipelines.md#get-a-single-pipeline) individually.
......@@ -74,6 +76,8 @@ Example of response
## Get a single pipeline
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
Get one pipeline from a project.
You can also get a single [child pipeline](../ci/pipelines/parent_child_pipelines.md).
......@@ -267,6 +271,8 @@ Sample response:
## Create a new pipeline
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
```plaintext
POST /projects/:id/pipeline
```
......@@ -316,6 +322,8 @@ Example of response
## Retry jobs in a pipeline
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
```plaintext
POST /projects/:id/pipelines/:pipeline_id/retry
```
......
......@@ -4,7 +4,7 @@ module API
module Entities
module Ci
class PipelineBasic < Grape::Entity
expose :id, :project_id, :sha, :ref, :status, :source
expose :id, :iid, :project_id, :sha, :ref, :status, :source
expose :created_at, :updated_at
expose :web_url do |pipeline, _options|
......
......@@ -14,6 +14,7 @@
"type": ["object", "null"],
"properties": {
"id": { "type": "integer" },
"iid": { "type": "integer" },
"project_id": { "type": "integer" },
"sha": { "type": "string" },
"ref": { "type": "string" },
......
......@@ -33,6 +33,7 @@ RSpec.describe API::Ci::Pipelines do
expect(json_response).to be_an Array
expect(json_response.first['sha']).to match(/\A\h{40}\z/)
expect(json_response.first['id']).to eq pipeline.id
expect(json_response.first['iid']).to eq pipeline.iid
expect(json_response.first['web_url']).to be_present
end
......@@ -40,7 +41,7 @@ RSpec.describe API::Ci::Pipelines do
it 'includes pipeline source' do
get api("/projects/#{project.id}/pipelines", user)
expect(json_response.first.keys).to contain_exactly(*%w[id project_id sha ref status web_url created_at updated_at source])
expect(json_response.first.keys).to contain_exactly(*%w[id iid project_id sha ref status web_url created_at updated_at source])
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment