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
3d4f0b1f
Commit
3d4f0b1f
authored
Sep 10, 2020
by
Alan (Maciej) Paruszewski
Committed by
Fabio Pitino
Sep 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return no scanners when pipeline has no reports
parent
9063dea6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
ee/app/models/concerns/ee/project_security_scanners_information.rb
...dels/concerns/ee/project_security_scanners_information.rb
+2
-0
ee/changelogs/unreleased/230825-follow-up-scanner-type-enum.yml
...ngelogs/unreleased/230825-follow-up-scanner-type-enum.yml
+5
-0
ee/spec/models/concerns/ee/project_security_scanners_information_spec.rb
...concerns/ee/project_security_scanners_information_spec.rb
+10
-2
No files found.
ee/app/models/concerns/ee/project_security_scanners_information.rb
View file @
3d4f0b1f
...
...
@@ -15,6 +15,8 @@ module EE
def
scanners_run_in_last_pipeline
reports
=
latest_builds_reports
(
only_successful_builds:
true
)
return
[]
if
reports
.
empty?
all_security_scanners
.
map
{
|
scanner
|
scanner
.
upcase
.
to_s
if
reports
.
include?
(
scanner
)
}.
compact
end
...
...
ee/changelogs/unreleased/230825-follow-up-scanner-type-enum.yml
0 → 100644
View file @
3d4f0b1f
---
title
:
Return empty scanners list when pipeline has no reports
merge_request
:
41652
author
:
type
:
performance
ee/spec/models/concerns/ee/project_security_scanners_information_spec.rb
View file @
3d4f0b1f
...
...
@@ -32,12 +32,20 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
end
describe
'#scanners_run_by_last_pipeline'
do
subject
(
:scanners_run_in_last_pipeline
)
{
project
.
scanners_run_in_last_pipeline
}
context
'when pipeline has no build reports'
do
let!
(
:new_pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
it
{
is_expected
.
to
be_empty
}
end
it
'returns a list of all scanners which were run successfully in the latest pipeline'
do
expect
(
project
.
scanners_run_in_last_pipeline
).
to
match_array
(
%w(DAST SAST)
)
expect
(
scanners_run_in_last_pipeline
).
to
match_array
(
%w(DAST SAST)
)
end
it
'does not include non-security scanners'
do
expect
(
project
.
scanners_run_in_last_pipeline
).
not_to
include
(
%w(LICENSE_SCANNING)
)
expect
(
scanners_run_in_last_pipeline
).
not_to
include
(
%w(LICENSE_SCANNING)
)
end
end
end
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