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
326a4a9d
Commit
326a4a9d
authored
Jun 18, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds ID to group, stage, and detailed status
Changelog: added
parent
d33dde1f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
83 additions
and
15 deletions
+83
-15
app/graphql/types/ci/build_need_type.rb
app/graphql/types/ci/build_need_type.rb
+2
-0
app/graphql/types/ci/detailed_status_type.rb
app/graphql/types/ci/detailed_status_type.rb
+7
-0
app/graphql/types/ci/group_type.rb
app/graphql/types/ci/group_type.rb
+5
-3
app/graphql/types/ci/stage_type.rb
app/graphql/types/ci/stage_type.rb
+6
-10
app/graphql/types/ci/status_action_type.rb
app/graphql/types/ci/status_action_type.rb
+7
-0
app/models/ci/group.rb
app/models/ci/group.rb
+5
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+5
-0
lib/gitlab/ci/status/core.rb
lib/gitlab/ci/status/core.rb
+4
-0
spec/graphql/types/ci/detailed_status_type_spec.rb
spec/graphql/types/ci/detailed_status_type_spec.rb
+14
-2
spec/graphql/types/ci/group_type_spec.rb
spec/graphql/types/ci/group_type_spec.rb
+1
-0
spec/graphql/types/ci/stage_type_spec.rb
spec/graphql/types/ci/stage_type_spec.rb
+1
-0
spec/graphql/types/ci/status_action_type_spec.rb
spec/graphql/types/ci/status_action_type_spec.rb
+20
-0
spec/requests/api/graphql/ci/jobs_spec.rb
spec/requests/api/graphql/ci/jobs_spec.rb
+6
-0
No files found.
app/graphql/types/ci/build_need_type.rb
View file @
326a4a9d
...
...
@@ -7,6 +7,8 @@ module Types
class
BuildNeedType
<
BaseObject
graphql_name
'CiBuildNeed'
field
:id
,
GraphQL
::
ID_TYPE
,
null:
false
,
description:
'ID of the job we need to complete.'
field
:name
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Name of the job we need to complete.'
end
...
...
app/graphql/types/ci/detailed_status_type.rb
View file @
326a4a9d
...
...
@@ -6,6 +6,9 @@ module Types
class
DetailedStatusType
<
BaseObject
graphql_name
'DetailedStatus'
field
:id
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'ID for a detailed status.'
,
extras:
[
:parent
]
field
:group
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Group of the status.'
field
:icon
,
GraphQL
::
STRING_TYPE
,
null:
true
,
...
...
@@ -29,6 +32,10 @@ module Types
calls_gitaly:
true
,
description:
'Action information for the status. This includes method, button title, icon, path, and title.'
def
id
(
parent
:)
"
#{
object
.
id
}
-
#{
parent
.
object
.
object
.
id
}
"
end
def
action
if
object
.
has_action?
{
...
...
app/graphql/types/ci/group_type.rb
View file @
326a4a9d
...
...
@@ -6,12 +6,14 @@ module Types
class
GroupType
<
BaseObject
graphql_name
'CiGroup'
field
:id
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'ID for a group.'
field
:name
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Name of the job group.'
description:
'Name of the job group.'
field
:size
,
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'Size of the group.'
description:
'Size of the group.'
field
:jobs
,
Ci
::
JobType
.
connection_type
,
null:
true
,
description:
'Jobs in group.'
description:
'Jobs in group.'
field
:detailed_status
,
Types
::
Ci
::
DetailedStatusType
,
null:
true
,
description:
'Detailed status of the group.'
...
...
app/graphql/types/ci/stage_type.rb
View file @
326a4a9d
...
...
@@ -6,20 +6,16 @@ module Types
graphql_name
'CiStage'
authorize
:read_commit_status
field
:
nam
e
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:
id
,
GraphQL
::
ID_TYPE
,
null:
fals
e
,
description:
'ID of the stage.'
field
:name
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Name of the stage.'
field
:groups
,
type:
Ci
::
GroupType
.
connection_type
,
null:
true
,
field
:groups
,
type:
Ci
::
GroupType
.
connection_type
,
null:
true
,
extras:
[
:lookahead
],
description:
'Group of jobs for the stage.'
field
:detailed_status
,
Types
::
Ci
::
DetailedStatusType
,
null:
true
,
field
:detailed_status
,
Types
::
Ci
::
DetailedStatusType
,
null:
true
,
description:
'Detailed status of the stage.'
field
:jobs
,
Ci
::
JobType
.
connection_type
,
null:
true
,
field
:jobs
,
Ci
::
JobType
.
connection_type
,
null:
true
,
description:
'Jobs for the stage.'
,
method:
'latest_statuses'
field
:status
,
GraphQL
::
STRING_TYPE
,
...
...
app/graphql/types/ci/status_action_type.rb
View file @
326a4a9d
...
...
@@ -5,6 +5,9 @@ module Types
class
StatusActionType
<
BaseObject
graphql_name
'StatusAction'
field
:id
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'ID for a status action.'
,
extras:
[
:parent
]
field
:button_title
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Title for the button, for example: Retry this job.'
field
:icon
,
GraphQL
::
STRING_TYPE
,
null:
true
,
...
...
@@ -17,6 +20,10 @@ module Types
field
:title
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Title for the action, for example: Retry.'
def
id
(
parent
:)
"
#{
parent
.
parent
.
object
.
object
.
class
.
name
}
-
#{
parent
.
object
.
object
.
id
}
"
end
def
action_method
object
[
:method
]
end
...
...
app/models/ci/group.rb
View file @
326a4a9d
...
...
@@ -10,6 +10,7 @@ module Ci
class
Group
include
StaticModel
include
Gitlab
::
Utils
::
StrongMemoize
include
GlobalID
::
Identification
attr_reader
:project
,
:stage
,
:name
,
:jobs
...
...
@@ -22,6 +23,10 @@ module Ci
@jobs
=
jobs
end
def
id
"
#{
stage
.
id
}
-
#{
name
}
"
end
def
==
(
other
)
other
.
present?
&&
other
.
is_a?
(
self
.
class
)
&&
project
==
other
.
project
&&
...
...
doc/api/graphql/reference/index.md
View file @
326a4a9d
...
...
@@ -7658,6 +7658,7 @@ Represents the total number of issues and their weights for a particular day.
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"cibuildneedid"
></a>
`id`
|
[
`ID!`
](
#id
)
| ID of the job we need to complete. |
|
<a
id=
"cibuildneedname"
></a>
`name`
|
[
`String`
](
#string
)
| Name of the job we need to complete. |
### `CiConfig`
...
...
@@ -7733,6 +7734,7 @@ Represents the total number of issues and their weights for a particular day.
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"cigroupdetailedstatus"
></a>
`detailedStatus`
|
[
`DetailedStatus`
](
#detailedstatus
)
| Detailed status of the group. |
|
<a
id=
"cigroupid"
></a>
`id`
|
[
`String!`
](
#string
)
| ID for a group. |
|
<a
id=
"cigroupjobs"
></a>
`jobs`
|
[
`CiJobConnection`
](
#cijobconnection
)
| Jobs in group. (see
[
Connections
](
#connections
)
) |
|
<a
id=
"cigroupname"
></a>
`name`
|
[
`String`
](
#string
)
| Name of the job group. |
|
<a
id=
"cigroupsize"
></a>
`size`
|
[
`Int`
](
#int
)
| Size of the group. |
...
...
@@ -7827,6 +7829,7 @@ Represents the total number of issues and their weights for a particular day.
| ---- | ---- | ----------- |
|
<a
id=
"cistagedetailedstatus"
></a>
`detailedStatus`
|
[
`DetailedStatus`
](
#detailedstatus
)
| Detailed status of the stage. |
|
<a
id=
"cistagegroups"
></a>
`groups`
|
[
`CiGroupConnection`
](
#cigroupconnection
)
| Group of jobs for the stage. (see
[
Connections
](
#connections
)
) |
|
<a
id=
"cistageid"
></a>
`id`
|
[
`ID!`
](
#id
)
| ID of the stage. |
|
<a
id=
"cistagejobs"
></a>
`jobs`
|
[
`CiJobConnection`
](
#cijobconnection
)
| Jobs for the stage. (see
[
Connections
](
#connections
)
) |
|
<a
id=
"cistagename"
></a>
`name`
|
[
`String`
](
#string
)
| Name of the stage. |
|
<a
id=
"cistagestatus"
></a>
`status`
|
[
`String`
](
#string
)
| Status of the pipeline stage. |
...
...
@@ -8491,6 +8494,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
|
<a
id=
"detailedstatusgroup"
></a>
`group`
|
[
`String`
](
#string
)
| Group of the status. |
|
<a
id=
"detailedstatushasdetails"
></a>
`hasDetails`
|
[
`Boolean`
](
#boolean
)
| Indicates if the status has further details. |
|
<a
id=
"detailedstatusicon"
></a>
`icon`
|
[
`String`
](
#string
)
| Icon of the status. |
|
<a
id=
"detailedstatusid"
></a>
`id`
|
[
`String!`
](
#string
)
| ID for a detailed status. |
|
<a
id=
"detailedstatuslabel"
></a>
`label`
|
[
`String`
](
#string
)
| Label of the status. |
|
<a
id=
"detailedstatustext"
></a>
`text`
|
[
`String`
](
#string
)
| Text of the status. |
|
<a
id=
"detailedstatustooltip"
></a>
`tooltip`
|
[
`String`
](
#string
)
| Tooltip associated with the status. |
...
...
@@ -13102,6 +13106,7 @@ Represents the Geo sync and verification state of a snippet repository.
| ---- | ---- | ----------- |
|
<a
id=
"statusactionbuttontitle"
></a>
`buttonTitle`
|
[
`String`
](
#string
)
| Title for the button, for example: Retry this job. |
|
<a
id=
"statusactionicon"
></a>
`icon`
|
[
`String`
](
#string
)
| Icon used in the action button. |
|
<a
id=
"statusactionid"
></a>
`id`
|
[
`String!`
](
#string
)
| ID for a status action. |
|
<a
id=
"statusactionmethod"
></a>
`method`
|
[
`String`
](
#string
)
| Method for the action, for example: :post. |
|
<a
id=
"statusactionpath"
></a>
`path`
|
[
`String`
](
#string
)
| Path for the action. |
|
<a
id=
"statusactiontitle"
></a>
`title`
|
[
`String`
](
#string
)
| Title for the action, for example: Retry. |
...
...
lib/gitlab/ci/status/core.rb
View file @
326a4a9d
...
...
@@ -18,6 +18,10 @@ module Gitlab
@user
=
user
end
def
id
"
#{
group
}
-
#{
subject
.
id
}
"
end
def
icon
raise
NotImplementedError
end
...
...
spec/graphql/types/ci/detailed_status_type_spec.rb
View file @
326a4a9d
...
...
@@ -8,14 +8,26 @@ RSpec.describe Types::Ci::DetailedStatusType do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'DetailedStatus'
)
}
it
'has all fields'
do
expect
(
described_class
).
to
have_graphql_fields
(
:group
,
:icon
,
:favicon
,
expect
(
described_class
).
to
have_graphql_fields
(
:
id
,
:
group
,
:icon
,
:favicon
,
:details_path
,
:has_details
,
:label
,
:text
,
:tooltip
,
:action
)
end
let_it_be
(
:stage
)
{
create
(
:ci_stage_entity
,
status: :skipped
)
}
describe
'id field'
do
it
'correctly renders the field'
do
parent_object
=
double
(
:parent_object
,
object:
stage
)
parent
=
double
(
:parent
,
object:
parent_object
)
status
=
stage
.
detailed_status
(
stage
.
pipeline
.
user
)
expected_id
=
"
#{
status
.
id
}
-
#{
stage
.
id
}
"
expect
(
resolve_field
(
'id'
,
status
,
extras:
{
parent:
parent
})).
to
eq
(
expected_id
)
end
end
describe
'action field'
do
it
'correctly renders the field'
do
stage
=
create
(
:ci_stage_entity
,
status: :skipped
)
status
=
stage
.
detailed_status
(
stage
.
pipeline
.
user
)
expected_status
=
{
...
...
spec/graphql/types/ci/group_type_spec.rb
View file @
326a4a9d
...
...
@@ -7,6 +7,7 @@ RSpec.describe Types::Ci::GroupType do
it
'exposes the expected fields'
do
expected_fields
=
%i[
id
name
size
jobs
...
...
spec/graphql/types/ci/stage_type_spec.rb
View file @
326a4a9d
...
...
@@ -7,6 +7,7 @@ RSpec.describe Types::Ci::StageType do
it
'exposes the expected fields'
do
expected_fields
=
%i[
id
name
groups
detailedStatus
...
...
spec/graphql/types/ci/status_action_type_spec.rb
View file @
326a4a9d
...
...
@@ -3,10 +3,13 @@
require
'spec_helper'
RSpec
.
describe
Types
::
Ci
::
StatusActionType
do
include
GraphqlHelpers
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'StatusAction'
)
}
it
'exposes the expected fields'
do
expected_fields
=
%i[
id
buttonTitle
icon
path
...
...
@@ -16,4 +19,21 @@ RSpec.describe Types::Ci::StatusActionType do
expect
(
described_class
).
to
have_graphql_fields
(
*
expected_fields
)
end
describe
'id field'
do
it
'correctly renders the field'
do
stage
=
build
(
:ci_stage_entity
,
status: :skipped
)
status
=
stage
.
detailed_status
(
stage
.
pipeline
.
user
)
grandparent_object
=
double
(
:grandparent_object
,
object:
stage
)
parent_object
=
double
(
:parent_object
,
object:
status
)
grandparent
=
double
(
:parent
,
object:
grandparent_object
)
parent
=
double
(
:parent
,
object:
parent_object
,
parent:
grandparent
)
expected_id
=
"
#{
stage
.
class
.
name
}
-
#{
status
.
id
}
"
expect
(
resolve_field
(
'id'
,
status
,
extras:
{
parent:
parent
})).
to
eq
(
expected_id
)
end
end
end
spec/requests/api/graphql/ci/jobs_spec.rb
View file @
326a4a9d
...
...
@@ -38,9 +38,15 @@ RSpec.describe 'Query.project.pipeline' do
name
groups {
nodes {
detailedStatus {
id
}
name
jobs {
nodes {
detailedStatus {
id
}
name
needs {
nodes {
#{
all_graphql_fields_for
(
'CiBuildNeed'
)
}
}
...
...
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