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
f810e67c
Commit
f810e67c
authored
Dec 17, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add downstream_pipeline field to JobType
parent
3b081dce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
app/graphql/types/ci/job_type.rb
app/graphql/types/ci/job_type.rb
+6
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/graphql/types/ci/job_type_spec.rb
spec/graphql/types/ci/job_type_spec.rb
+1
-0
spec/requests/api/graphql/ci/jobs_spec.rb
spec/requests/api/graphql/ci/jobs_spec.rb
+8
-0
No files found.
app/graphql/types/ci/job_type.rb
View file @
f810e67c
...
...
@@ -50,6 +50,8 @@ module Types
null:
true
,
description:
'How long the job was enqueued before starting.'
field
:downstream_pipeline
,
Types
::
Ci
::
PipelineType
,
null:
true
,
description:
'Downstream pipeline for a bridge.'
field
:previous_stage_jobs_or_needs
,
Types
::
Ci
::
JobNeedUnion
.
connection_type
,
null:
true
,
description:
'Jobs that must complete before the job runs. Returns `BuildNeed`, which is the needed jobs if the job uses the `needs` keyword, or the previous stage jobs otherwise.'
field
:detailed_status
,
Types
::
Ci
::
DetailedStatusType
,
null:
true
,
...
...
@@ -89,6 +91,10 @@ module Types
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
::
Ci
::
Pipeline
,
object
.
pipeline_id
).
find
end
def
downstream_pipeline
object
.
downstream_pipeline
if
object
.
respond_to?
(
:downstream_pipeline
)
end
def
tags
object
.
tags
.
map
(
&
:name
)
if
object
.
is_a?
(
::
Ci
::
Build
)
end
...
...
doc/api/graphql/reference/index.md
View file @
f810e67c
...
...
@@ -8813,6 +8813,7 @@ Represents the total number of issues and their weights for a particular day.
| <a id="cijobcreatedat"></a>`createdAt` | [`Time!`](#time) | When the job was created. |
| <a id="cijobcreatedbytag"></a>`createdByTag` | [`Boolean!`](#boolean) | Whether the job was created by a tag. |
| <a id="cijobdetailedstatus"></a>`detailedStatus` | [`DetailedStatus`](#detailedstatus) | Detailed status of the job. |
| <a id="cijobdownstreampipeline"></a>`downstreamPipeline` | [`Pipeline`](#pipeline) | Downstream pipeline for a bridge. |
| <a id="cijobduration"></a>`duration` | [`Int`](#int) | Duration of the job in seconds. |
| <a id="cijobfinishedat"></a>`finishedAt` | [`Time`](#time) | When a job has finished running. |
| <a id="cijobid"></a>`id` | [`JobID`](#jobid) | ID of the job. |
spec/graphql/types/ci/job_type_spec.rb
View file @
f810e67c
...
...
@@ -18,6 +18,7 @@ RSpec.describe Types::Ci::JobType do
created_by_tag
detailedStatus
duration
downstreamPipeline
finished_at
id
manual_job
...
...
spec/requests/api/graphql/ci/jobs_spec.rb
View file @
f810e67c
...
...
@@ -44,6 +44,10 @@ RSpec.describe 'Query.project.pipeline' do
name
jobs {
nodes {
downstreamPipeline {
id
path
}
name
needs {
nodes {
#{
all_graphql_fields_for
(
'CiBuildNeed'
)
}
}
...
...
@@ -131,6 +135,8 @@ RSpec.describe 'Query.project.pipeline' do
end
it
'does not generate N+1 queries'
,
:request_store
,
:use_sql_query_cache
do
create
(
:ci_bridge
,
name:
'bridge-1'
,
pipeline:
pipeline
,
downstream_pipeline:
create
(
:ci_pipeline
))
post_graphql
(
query
,
current_user:
user
)
control
=
ActiveRecord
::
QueryRecorder
.
new
(
skip_cached:
false
)
do
...
...
@@ -139,6 +145,8 @@ RSpec.describe 'Query.project.pipeline' do
create
(
:ci_build
,
name:
'test-a'
,
pipeline:
pipeline
)
create
(
:ci_build
,
name:
'test-b'
,
pipeline:
pipeline
)
create
(
:ci_bridge
,
name:
'bridge-2'
,
pipeline:
pipeline
,
downstream_pipeline:
create
(
:ci_pipeline
))
create
(
:ci_bridge
,
name:
'bridge-3'
,
pipeline:
pipeline
,
downstream_pipeline:
create
(
:ci_pipeline
))
expect
do
post_graphql
(
query
,
current_user:
user
)
...
...
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