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
39fc0d50
Commit
39fc0d50
authored
Jul 17, 2020
by
Allison Browne
Committed by
Fabio Pitino
Jul 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add changelog for:
Bug Fix: Child pipelines are not found by API endpoint
parent
1ad2429e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
3 deletions
+49
-3
app/models/ci/pipeline_enums.rb
app/models/ci/pipeline_enums.rb
+4
-0
changelogs/unreleased/207226-child-pipelines-and-their-jobs-are-not-found-by-api-endpoints.yml
...pelines-and-their-jobs-are-not-found-by-api-endpoints.yml
+5
-0
doc/api/jobs.md
doc/api/jobs.md
+3
-0
doc/api/pipelines.md
doc/api/pipelines.md
+8
-0
lib/api/ci/pipelines.rb
lib/api/ci/pipelines.rb
+1
-1
lib/api/jobs.rb
lib/api/jobs.rb
+1
-1
spec/requests/api/ci/pipelines_spec.rb
spec/requests/api/ci/pipelines_spec.rb
+15
-1
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+12
-0
No files found.
app/models/ci/pipeline_enums.rb
View file @
39fc0d50
...
@@ -63,6 +63,10 @@ module Ci
...
@@ -63,6 +63,10 @@ module Ci
def
self
.
ci_config_sources_values
def
self
.
ci_config_sources_values
ci_config_sources
.
values
ci_config_sources
.
values
end
end
def
self
.
non_ci_config_source_values
config_sources
.
values
-
ci_config_sources
.
values
end
end
end
end
end
...
...
changelogs/unreleased/207226-child-pipelines-and-their-jobs-are-not-found-by-api-endpoints.yml
0 → 100644
View file @
39fc0d50
---
title
:
'
Bug
Fix:
Child
pipelines
are
not
found
by
API
endpoints'
merge_request
:
36494
author
:
type
:
fixed
doc/api/jobs.md
View file @
39fc0d50
...
@@ -269,6 +269,9 @@ Example of response
...
@@ -269,6 +269,9 @@ Example of response
]
]
```
```
Since GitLab 13.2, this endpoint
[
returns data for any pipeline
](
pipelines.md#single-pipeline-requests
)
including
[
child pipelines
](
../ci/parent_child_pipelines.md
)
.
## List pipeline bridges
## List pipeline bridges
Get a list of bridge jobs for a pipeline.
Get a list of bridge jobs for a pipeline.
...
...
doc/api/pipelines.md
View file @
39fc0d50
# Pipelines API
# Pipelines API
## Single Pipeline Requests
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36494) in GitLab 13.2.
Endpoints that request information about a single pipeline return data for any pipeline.
Before 13.2, requests for
[
child pipelines
](
../ci/parent_child_pipelines.md
)
returned
a 404 error.
## Pipelines pagination
## Pipelines pagination
By default,
`GET`
requests return 20 results at a time because the API results
By default,
`GET`
requests return 20 results at a time because the API results
...
...
lib/api/ci/pipelines.rb
View file @
39fc0d50
...
@@ -174,7 +174,7 @@ module API
...
@@ -174,7 +174,7 @@ module API
helpers
do
helpers
do
def
pipeline
def
pipeline
strong_memoize
(
:pipeline
)
do
strong_memoize
(
:pipeline
)
do
user_project
.
ci
_pipelines
.
find
(
params
[
:pipeline_id
])
user_project
.
all
_pipelines
.
find
(
params
[
:pipeline_id
])
end
end
end
end
...
...
lib/api/jobs.rb
View file @
39fc0d50
...
@@ -59,7 +59,7 @@ module API
...
@@ -59,7 +59,7 @@ module API
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
get
':id/pipelines/:pipeline_id/jobs'
do
get
':id/pipelines/:pipeline_id/jobs'
do
authorize!
(
:read_pipeline
,
user_project
)
authorize!
(
:read_pipeline
,
user_project
)
pipeline
=
user_project
.
ci
_pipelines
.
find
(
params
[
:pipeline_id
])
pipeline
=
user_project
.
all
_pipelines
.
find
(
params
[
:pipeline_id
])
authorize!
(
:read_build
,
pipeline
)
authorize!
(
:read_build
,
pipeline
)
builds
=
pipeline
.
builds
builds
=
pipeline
.
builds
...
...
spec/requests/api/ci/pipelines_spec.rb
View file @
39fc0d50
...
@@ -438,7 +438,7 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -438,7 +438,7 @@ RSpec.describe API::Ci::Pipelines do
expect
(
response
).
to
match_response_schema
(
'public_api/v4/pipeline/detail'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/pipeline/detail'
)
end
end
it
'returns project pipeline
s
'
do
it
'returns project pipeline'
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines/
#{
pipeline
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/pipelines/
#{
pipeline
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -475,6 +475,20 @@ RSpec.describe API::Ci::Pipelines do
...
@@ -475,6 +475,20 @@ RSpec.describe API::Ci::Pipelines do
expect
(
json_response
[
'id'
]).
to
be
nil
expect
(
json_response
[
'id'
]).
to
be
nil
end
end
end
end
context
'when config source is not ci'
do
let
(
:non_ci_config_source
)
{
::
Ci
::
PipelineEnums
.
non_ci_config_source_values
.
first
}
let
(
:pipeline_not_ci
)
do
create
(
:ci_pipeline
,
config_source:
non_ci_config_source
,
project:
project
)
end
it
'returns the specified pipeline'
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines/
#{
pipeline_not_ci
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'sha'
]).
to
eq
(
pipeline_not_ci
.
sha
)
end
end
end
end
describe
'GET /projects/:id/pipelines/latest'
do
describe
'GET /projects/:id/pipelines/latest'
do
...
...
spec/requests/api/jobs_spec.rb
View file @
39fc0d50
...
@@ -239,6 +239,18 @@ RSpec.describe API::Jobs do
...
@@ -239,6 +239,18 @@ RSpec.describe API::Jobs do
end
end
end
end
context
'when config source not ci'
do
let
(
:non_ci_config_source
)
{
::
Ci
::
PipelineEnums
.
non_ci_config_source_values
.
first
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
config_source:
non_ci_config_source
,
project:
project
)
end
it
'returns the specified pipeline'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
0
][
'pipeline'
][
'sha'
]).
to
eq
(
pipeline
.
sha
.
to_s
)
end
end
it
'avoids N+1 queries'
do
it
'avoids N+1 queries'
do
control_count
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
control_count
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines/
#{
pipeline
.
id
}
/jobs"
,
api_user
),
params:
query
get
api
(
"/projects/
#{
project
.
id
}
/pipelines/
#{
pipeline
.
id
}
/jobs"
,
api_user
),
params:
query
...
...
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