Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9e43582c
Commit
9e43582c
authored
Mar 11, 2021
by
Emily Ring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project_id to pipeline REST api
Add project_id to Pipeline entity Update associated tests and docs
parent
da75cd82
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
3 deletions
+28
-3
changelogs/unreleased/323863-add-project-id.yml
changelogs/unreleased/323863-add-project-id.yml
+5
-0
doc/api/jobs.md
doc/api/jobs.md
+7
-0
doc/api/pipelines.md
doc/api/pipelines.md
+6
-0
lib/api/entities/ci/pipeline_basic.rb
lib/api/entities/ci/pipeline_basic.rb
+1
-1
spec/fixtures/api/schemas/public_api/v4/pipeline.json
spec/fixtures/api/schemas/public_api/v4/pipeline.json
+4
-1
spec/requests/api/ci/pipelines_spec.rb
spec/requests/api/ci/pipelines_spec.rb
+4
-1
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+1
-0
No files found.
changelogs/unreleased/323863-add-project-id.yml
0 → 100644
View file @
9e43582c
---
title
:
Add project_id to pipeline api
merge_request
:
56339
author
:
type
:
changed
doc/api/jobs.md
View file @
9e43582c
...
@@ -61,6 +61,7 @@ Example of response
...
@@ -61,6 +61,7 @@ Example of response
"name"
:
"teaspoon"
,
"name"
:
"teaspoon"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
@@ -114,6 +115,7 @@ Example of response
...
@@ -114,6 +115,7 @@ Example of response
"name"
:
"rspec:other"
,
"name"
:
"rspec:other"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
@@ -193,6 +195,7 @@ Example of response
...
@@ -193,6 +195,7 @@ Example of response
"name"
:
"rspec:other"
,
"name"
:
"rspec:other"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
@@ -256,6 +259,7 @@ Example of response
...
@@ -256,6 +259,7 @@ Example of response
"name"
:
"teaspoon"
,
"name"
:
"teaspoon"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
@@ -338,6 +342,7 @@ Example of response
...
@@ -338,6 +342,7 @@ Example of response
"name"
:
"teaspoon"
,
"name"
:
"teaspoon"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
,
"status"
:
"pending"
,
...
@@ -419,6 +424,7 @@ Example of response
...
@@ -419,6 +424,7 @@ Example of response
"name"
:
"rubocop"
,
"name"
:
"rubocop"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
@@ -494,6 +500,7 @@ Example of response
...
@@ -494,6 +500,7 @@ Example of response
"name"
:
"rubocop"
,
"name"
:
"rubocop"
,
"pipeline"
:
{
"pipeline"
:
{
"id"
:
6
,
"id"
:
6
,
"project_id"
:
1
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"sha"
:
"0ff3ae198f8601a285adcf5c0fff204ee6fba5fd"
,
"status"
:
"pending"
"status"
:
"pending"
...
...
doc/api/pipelines.md
View file @
9e43582c
...
@@ -54,6 +54,7 @@ Example of response
...
@@ -54,6 +54,7 @@ Example of response
[
[
{
{
"id"
:
47
,
"id"
:
47
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"new-pipeline"
,
"ref"
:
"new-pipeline"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
...
@@ -63,6 +64,7 @@ Example of response
...
@@ -63,6 +64,7 @@ Example of response
},
},
{
{
"id"
:
48
,
"id"
:
48
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"new-pipeline"
,
"ref"
:
"new-pipeline"
,
"sha"
:
"eb94b618fb5865b26e80fdd8ae531b7a63ad851a"
,
"sha"
:
"eb94b618fb5865b26e80fdd8ae531b7a63ad851a"
,
...
@@ -95,6 +97,7 @@ Example of response
...
@@ -95,6 +97,7 @@ Example of response
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"project_id"
:
1
,
"status"
:
"success"
,
"status"
:
"success"
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
...
@@ -230,6 +233,7 @@ Example of response
...
@@ -230,6 +233,7 @@ Example of response
```
json
```
json
{
{
"id"
:
61
,
"id"
:
61
,
"project_id"
:
1
,
"sha"
:
"384c444e840a515b23f21915ee5766b87068a70d"
,
"sha"
:
"384c444e840a515b23f21915ee5766b87068a70d"
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"status"
:
"pending"
,
"status"
:
"pending"
,
...
@@ -277,6 +281,7 @@ Response:
...
@@ -277,6 +281,7 @@ Response:
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"project_id"
:
1
,
"status"
:
"pending"
,
"status"
:
"pending"
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
...
@@ -324,6 +329,7 @@ Response:
...
@@ -324,6 +329,7 @@ Response:
```
json
```
json
{
{
"id"
:
46
,
"id"
:
46
,
"project_id"
:
1
,
"status"
:
"canceled"
,
"status"
:
"canceled"
,
"ref"
:
"master"
,
"ref"
:
"master"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
"sha"
:
"a91957a858320c0e17f3a0eca7cfacbff50ea29a"
,
...
...
lib/api/entities/ci/pipeline_basic.rb
View file @
9e43582c
...
@@ -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
,
:sha
,
:ref
,
:status
expose
:id
,
:
project_id
,
:
sha
,
:ref
,
:status
expose
:created_at
,
:updated_at
expose
:created_at
,
:updated_at
expose
:web_url
do
|
pipeline
,
_options
|
expose
:web_url
do
|
pipeline
,
_options
|
...
...
spec/fixtures/api/schemas/public_api/v4/pipeline.json
View file @
9e43582c
{
{
"type"
:
"object"
,
"type"
:
"object"
,
"required"
:
[
"id"
,
"sha"
,
"ref"
,
"status"
,
"created_at"
,
"updated_at"
,
"web_url"
],
"required"
:
[
"id"
,
"
project_id"
,
"
sha"
,
"ref"
,
"status"
,
"created_at"
,
"updated_at"
,
"web_url"
],
"properties"
:
{
"properties"
:
{
"id"
:
{
"id"
:
{
"type"
:
"integer"
"type"
:
"integer"
},
},
"project_id"
:
{
"type"
:
"integer"
},
"sha"
:
{
"sha"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
...
...
spec/requests/api/ci/pipelines_spec.rb
View file @
9e43582c
...
@@ -34,7 +34,7 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -34,7 +34,7 @@ RSpec.describe API::Ci::Pipelines do
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
[
'web_url'
]).
to
be_present
expect
(
json_response
.
first
[
'web_url'
]).
to
be_present
expect
(
json_response
.
first
.
keys
).
to
contain_exactly
(
*
%w[id sha ref status web_url created_at updated_at]
)
expect
(
json_response
.
first
.
keys
).
to
contain_exactly
(
*
%w[id
project_id
sha ref status web_url created_at updated_at]
)
end
end
context
'when parameter is passed'
do
context
'when parameter is passed'
do
...
@@ -350,6 +350,7 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -350,6 +350,7 @@ RSpec.describe API::Ci::Pipelines do
expect
(
json_job
[
'pipeline'
]).
not_to
be_empty
expect
(
json_job
[
'pipeline'
]).
not_to
be_empty
expect
(
json_job
[
'pipeline'
][
'id'
]).
to
eq
job
.
pipeline
.
id
expect
(
json_job
[
'pipeline'
][
'id'
]).
to
eq
job
.
pipeline
.
id
expect
(
json_job
[
'pipeline'
][
'project_id'
]).
to
eq
job
.
pipeline
.
project_id
expect
(
json_job
[
'pipeline'
][
'ref'
]).
to
eq
job
.
pipeline
.
ref
expect
(
json_job
[
'pipeline'
][
'ref'
]).
to
eq
job
.
pipeline
.
ref
expect
(
json_job
[
'pipeline'
][
'sha'
]).
to
eq
job
.
pipeline
.
sha
expect
(
json_job
[
'pipeline'
][
'sha'
]).
to
eq
job
.
pipeline
.
sha
expect
(
json_job
[
'pipeline'
][
'status'
]).
to
eq
job
.
pipeline
.
status
expect
(
json_job
[
'pipeline'
][
'status'
]).
to
eq
job
.
pipeline
.
status
...
@@ -512,6 +513,7 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -512,6 +513,7 @@ RSpec.describe API::Ci::Pipelines do
expect
(
json_bridge
[
'pipeline'
]).
not_to
be_empty
expect
(
json_bridge
[
'pipeline'
]).
not_to
be_empty
expect
(
json_bridge
[
'pipeline'
][
'id'
]).
to
eq
bridge
.
pipeline
.
id
expect
(
json_bridge
[
'pipeline'
][
'id'
]).
to
eq
bridge
.
pipeline
.
id
expect
(
json_bridge
[
'pipeline'
][
'project_id'
]).
to
eq
bridge
.
pipeline
.
project_id
expect
(
json_bridge
[
'pipeline'
][
'ref'
]).
to
eq
bridge
.
pipeline
.
ref
expect
(
json_bridge
[
'pipeline'
][
'ref'
]).
to
eq
bridge
.
pipeline
.
ref
expect
(
json_bridge
[
'pipeline'
][
'sha'
]).
to
eq
bridge
.
pipeline
.
sha
expect
(
json_bridge
[
'pipeline'
][
'sha'
]).
to
eq
bridge
.
pipeline
.
sha
expect
(
json_bridge
[
'pipeline'
][
'status'
]).
to
eq
bridge
.
pipeline
.
status
expect
(
json_bridge
[
'pipeline'
][
'status'
]).
to
eq
bridge
.
pipeline
.
status
...
@@ -522,6 +524,7 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -522,6 +524,7 @@ RSpec.describe API::Ci::Pipelines do
expect
(
json_bridge
[
'downstream_pipeline'
]).
not_to
be_empty
expect
(
json_bridge
[
'downstream_pipeline'
]).
not_to
be_empty
expect
(
json_bridge
[
'downstream_pipeline'
][
'id'
]).
to
eq
downstream_pipeline
.
id
expect
(
json_bridge
[
'downstream_pipeline'
][
'id'
]).
to
eq
downstream_pipeline
.
id
expect
(
json_bridge
[
'downstream_pipeline'
][
'project_id'
]).
to
eq
downstream_pipeline
.
project_id
expect
(
json_bridge
[
'downstream_pipeline'
][
'ref'
]).
to
eq
downstream_pipeline
.
ref
expect
(
json_bridge
[
'downstream_pipeline'
][
'ref'
]).
to
eq
downstream_pipeline
.
ref
expect
(
json_bridge
[
'downstream_pipeline'
][
'sha'
]).
to
eq
downstream_pipeline
.
sha
expect
(
json_bridge
[
'downstream_pipeline'
][
'sha'
]).
to
eq
downstream_pipeline
.
sha
expect
(
json_bridge
[
'downstream_pipeline'
][
'status'
]).
to
eq
downstream_pipeline
.
status
expect
(
json_bridge
[
'downstream_pipeline'
][
'status'
]).
to
eq
downstream_pipeline
.
status
...
...
spec/requests/api/jobs_spec.rb
View file @
9e43582c
...
@@ -44,6 +44,7 @@ RSpec.describe API::Jobs do
...
@@ -44,6 +44,7 @@ RSpec.describe API::Jobs do
it
'returns common pipeline data'
do
it
'returns common pipeline data'
do
expect
(
json_response
[
'pipeline'
]).
not_to
be_empty
expect
(
json_response
[
'pipeline'
]).
not_to
be_empty
expect
(
json_response
[
'pipeline'
][
'id'
]).
to
eq
jobx
.
pipeline
.
id
expect
(
json_response
[
'pipeline'
][
'id'
]).
to
eq
jobx
.
pipeline
.
id
expect
(
json_response
[
'pipeline'
][
'project_id'
]).
to
eq
jobx
.
pipeline
.
project_id
expect
(
json_response
[
'pipeline'
][
'ref'
]).
to
eq
jobx
.
pipeline
.
ref
expect
(
json_response
[
'pipeline'
][
'ref'
]).
to
eq
jobx
.
pipeline
.
ref
expect
(
json_response
[
'pipeline'
][
'sha'
]).
to
eq
jobx
.
pipeline
.
sha
expect
(
json_response
[
'pipeline'
][
'sha'
]).
to
eq
jobx
.
pipeline
.
sha
expect
(
json_response
[
'pipeline'
][
'status'
]).
to
eq
jobx
.
pipeline
.
status
expect
(
json_response
[
'pipeline'
][
'status'
]).
to
eq
jobx
.
pipeline
.
status
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment