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
66019cdb
Commit
66019cdb
authored
Feb 15, 2021
by
Jonathan Schafer
Committed by
Luke Duncalfe
Feb 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hasSecurityReports to GraphQL MergeRequestType
Update docs, schema, and tests
parent
33f7a2bc
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
0 deletions
+61
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+5
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+18
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
ee/app/graphql/ee/types/merge_request_type.rb
ee/app/graphql/ee/types/merge_request_type.rb
+5
-0
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+4
-0
ee/changelogs/unreleased/275818-be-add-info-error-messages-to-security-widget-summary.yml
...be-add-info-error-messages-to-security-widget-summary.yml
+5
-0
ee/spec/graphql/ee/types/merge_request_type_spec.rb
ee/spec/graphql/ee/types/merge_request_type_spec.rb
+1
-0
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+22
-0
No files found.
doc/api/graphql/reference/gitlab_schema.graphql
View file @
66019cdb
...
@@ -15259,6 +15259,11 @@ type MergeRequest implements CurrentUserTodos & Noteable {
...
@@ -15259,6 +15259,11 @@ type MergeRequest implements CurrentUserTodos & Noteable {
"""
"""
hasCi
:
Boolean
!
hasCi
:
Boolean
!
"""
Indicates
if
the
source
branch
has
any
security
reports
.
"""
hasSecurityReports
:
Boolean
!
"""
"""
The
pipeline
running
on
the
branch
HEAD
of
the
merge
request
.
The
pipeline
running
on
the
branch
HEAD
of
the
merge
request
.
"""
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
66019cdb
...
@@ -41641,6 +41641,24 @@
...
@@ -41641,6 +41641,24 @@
"isDeprecated": false,
"isDeprecated": false,
"deprecationReason": null
"deprecationReason": null
},
},
{
"name": "hasSecurityReports",
"description": "Indicates if the source branch has any security reports.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
{
"name": "headPipeline",
"name": "headPipeline",
"description": "The pipeline running on the branch HEAD of the merge request.",
"description": "The pipeline running on the branch HEAD of the merge request.",
doc/api/graphql/reference/index.md
View file @
66019cdb
...
@@ -2309,6 +2309,7 @@ Autogenerated return type of MarkAsSpamSnippet.
...
@@ -2309,6 +2309,7 @@ Autogenerated return type of MarkAsSpamSnippet.
|
`downvotes`
| Int! | Number of downvotes for the merge request. |
|
`downvotes`
| Int! | Number of downvotes for the merge request. |
|
`forceRemoveSourceBranch`
| Boolean | Indicates if the project settings will lead to source branch deletion after merge. |
|
`forceRemoveSourceBranch`
| Boolean | Indicates if the project settings will lead to source branch deletion after merge. |
|
`hasCi`
| Boolean! | Indicates if the merge request has CI. |
|
`hasCi`
| Boolean! | Indicates if the merge request has CI. |
|
`hasSecurityReports`
| Boolean! | Indicates if the source branch has any security reports. |
|
`headPipeline`
| Pipeline | The pipeline running on the branch HEAD of the merge request. |
|
`headPipeline`
| Pipeline | The pipeline running on the branch HEAD of the merge request. |
|
`id`
| ID! | ID of the merge request. |
|
`id`
| ID! | ID of the merge request. |
|
`iid`
| String! | Internal ID of the merge request. |
|
`iid`
| String! | Internal ID of the merge request. |
...
...
ee/app/graphql/ee/types/merge_request_type.rb
View file @
66019cdb
...
@@ -14,6 +14,11 @@ module EE
...
@@ -14,6 +14,11 @@ module EE
description:
'Number of approvals required.'
description:
'Number of approvals required.'
field
:merge_trains_count
,
GraphQL
::
INT_TYPE
,
null:
true
,
field
:merge_trains_count
,
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'Number of merge requests in the merge train.'
description:
'Number of merge requests in the merge train.'
field
:has_security_reports
,
GraphQL
::
BOOLEAN_TYPE
,
null:
false
,
calls_gitaly:
true
,
method: :has_security_reports?
,
description:
'Indicates if the source branch has any security reports.'
end
end
def
merge_trains_count
def
merge_trains_count
...
...
ee/app/models/ee/merge_request.rb
View file @
66019cdb
...
@@ -169,6 +169,10 @@ module EE
...
@@ -169,6 +169,10 @@ module EE
}
}
end
end
def
has_security_reports?
!!
actual_head_pipeline
&
.
has_reports?
(
::
Ci
::
JobArtifact
.
security_reports
)
end
def
has_dependency_scanning_reports?
def
has_dependency_scanning_reports?
!!
actual_head_pipeline
&
.
has_reports?
(
::
Ci
::
JobArtifact
.
dependency_list_reports
)
!!
actual_head_pipeline
&
.
has_reports?
(
::
Ci
::
JobArtifact
.
dependency_list_reports
)
end
end
...
...
ee/changelogs/unreleased/275818-be-add-info-error-messages-to-security-widget-summary.yml
0 → 100644
View file @
66019cdb
---
title
:
Add hasSecurityReports field to GraphQL MergeRequest type
merge_request
:
53925
author
:
type
:
added
ee/spec/graphql/ee/types/merge_request_type_spec.rb
View file @
66019cdb
...
@@ -6,4 +6,5 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
...
@@ -6,4 +6,5 @@ RSpec.describe GitlabSchema.types['MergeRequest'] do
it
{
expect
(
described_class
).
to
have_graphql_fields
(
:approvals_required
,
:merge_trains_count
).
at_least
}
it
{
expect
(
described_class
).
to
have_graphql_fields
(
:approvals_required
,
:merge_trains_count
).
at_least
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:approved
,
complexity:
2
,
calls_gitaly?:
true
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:approved
,
complexity:
2
,
calls_gitaly?:
true
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:approvals_left
,
complexity:
2
,
calls_gitaly?:
true
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:approvals_left
,
complexity:
2
,
calls_gitaly?:
true
)
}
it
{
expect
(
described_class
).
to
have_graphql_field
(
:has_security_reports
,
calls_gitaly?:
true
)
}
end
end
ee/spec/models/merge_request_spec.rb
View file @
66019cdb
...
@@ -288,6 +288,28 @@ RSpec.describe MergeRequest do
...
@@ -288,6 +288,28 @@ RSpec.describe MergeRequest do
end
end
end
end
describe
'#has_security_reports?'
do
subject
{
merge_request
.
has_security_reports?
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
stub_licensed_features
(
dast:
true
)
end
context
'when head pipeline has security reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_dast_reports
,
source_project:
project
)
}
it
{
is_expected
.
to
be_truthy
}
end
context
'when head pipeline does not have security reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
source_project:
project
)
}
it
{
is_expected
.
to
be_falsey
}
end
end
describe
'#has_license_scanning_reports?'
do
describe
'#has_license_scanning_reports?'
do
subject
{
merge_request
.
has_license_scanning_reports?
}
subject
{
merge_request
.
has_license_scanning_reports?
}
...
...
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