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). ...@@ -15,6 +15,8 @@ Read more on [pagination](index.md#pagination).
## List project pipelines ## 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, 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. but you can [get child pipeline](pipelines.md#get-a-single-pipeline) individually.
...@@ -74,6 +76,8 @@ Example of response ...@@ -74,6 +76,8 @@ Example of response
## Get a single pipeline ## 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. Get one pipeline from a project.
You can also get a single [child pipeline](../ci/pipelines/parent_child_pipelines.md). You can also get a single [child pipeline](../ci/pipelines/parent_child_pipelines.md).
...@@ -267,6 +271,8 @@ Sample response: ...@@ -267,6 +271,8 @@ Sample response:
## Create a new pipeline ## Create a new pipeline
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
```plaintext ```plaintext
POST /projects/:id/pipeline POST /projects/:id/pipeline
``` ```
...@@ -316,6 +322,8 @@ Example of response ...@@ -316,6 +322,8 @@ Example of response
## Retry jobs in a pipeline ## Retry jobs in a pipeline
> `iid` in response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/342223) in GitLab 14.6.
```plaintext ```plaintext
POST /projects/:id/pipelines/:pipeline_id/retry POST /projects/:id/pipelines/:pipeline_id/retry
``` ```
......
...@@ -4,7 +4,7 @@ module API ...@@ -4,7 +4,7 @@ module API
module Entities module Entities
module Ci module Ci
class PipelineBasic < Grape::Entity 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 :created_at, :updated_at
expose :web_url do |pipeline, _options| expose :web_url do |pipeline, _options|
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"type": ["object", "null"], "type": ["object", "null"],
"properties": { "properties": {
"id": { "type": "integer" }, "id": { "type": "integer" },
"iid": { "type": "integer" },
"project_id": { "type": "integer" }, "project_id": { "type": "integer" },
"sha": { "type": "string" }, "sha": { "type": "string" },
"ref": { "type": "string" }, "ref": { "type": "string" },
......
...@@ -33,6 +33,7 @@ RSpec.describe API::Ci::Pipelines do ...@@ -33,6 +33,7 @@ RSpec.describe API::Ci::Pipelines do
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.first['sha']).to match(/\A\h{40}\z/) expect(json_response.first['sha']).to match(/\A\h{40}\z/)
expect(json_response.first['id']).to eq pipeline.id 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 expect(json_response.first['web_url']).to be_present
end end
...@@ -40,7 +41,7 @@ RSpec.describe API::Ci::Pipelines do ...@@ -40,7 +41,7 @@ RSpec.describe API::Ci::Pipelines do
it 'includes pipeline source' do it 'includes pipeline source' do
get api("/projects/#{project.id}/pipelines", user) 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
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