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
67454bc9
Commit
67454bc9
authored
Dec 17, 2019
by
scardoso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow projects and groups to use summary cache
parent
d0b6d109
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
ee/app/controllers/concerns/project_vulnerability_findings_actions.rb
...ollers/concerns/project_vulnerability_findings_actions.rb
+1
-1
ee/lib/gitlab/vulnerabilities/summary.rb
ee/lib/gitlab/vulnerabilities/summary.rb
+10
-8
ee/lib/gitlab/vulnerabilities/summary_cache.rb
ee/lib/gitlab/vulnerabilities/summary_cache.rb
+4
-4
No files found.
ee/app/controllers/concerns/project_vulnerability_findings_actions.rb
View file @
67454bc9
...
...
@@ -23,7 +23,7 @@ module ProjectVulnerabilityFindingsActions
end
def
summary
summary
=
Gitlab
::
Vulnerabilities
::
Summary
.
new
(
group
,
filter_params
).
findings_counter
summary
=
Gitlab
::
Vulnerabilities
::
Summary
.
new
(
vulnerable
,
filter_params
).
findings_counter
respond_to
do
|
format
|
format
.
json
do
...
...
ee/lib/gitlab/vulnerabilities/summary.rb
View file @
67454bc9
...
...
@@ -3,11 +3,11 @@
module
Gitlab
module
Vulnerabilities
class
Summary
attr_reader
:
group
,
:filters
attr_reader
:
vulnerable
,
:filters
def
initialize
(
group
,
params
)
def
initialize
(
vulnerable
,
params
)
@filters
=
params
@
group
=
group
@
vulnerable
=
vulnerable
end
def
findings_counter
...
...
@@ -34,7 +34,7 @@ module Gitlab
project_ids_to_fetch
.
each
do
|
project_id
|
project_summary
=
Gitlab
::
Vulnerabilities
::
SummaryCache
.
new
(
group
,
project_id
)
.
new
(
vulnerable
,
project_id
)
.
fetch
summary_keys
.
each
do
|
key
|
...
...
@@ -46,11 +46,11 @@ module Gitlab
end
def
found_vulnerabilities
::
Security
::
VulnerabilityFindingsFinder
.
new
(
group
,
params:
filters
).
execute
::
Security
::
VulnerabilityFindingsFinder
.
new
(
vulnerable
,
params:
filters
).
execute
end
def
use_vulnerability_cache?
Feature
.
enabled?
(
:cache_vulnerability_summary
,
group
)
&&
!
dynamic_filters_included?
Feature
.
enabled?
(
:cache_vulnerability_summary
,
vulnerable
)
&&
!
dynamic_filters_included?
end
def
dynamic_filters_included?
...
...
@@ -60,9 +60,11 @@ module Gitlab
end
def
project_ids_to_fetch
return
filters
[
:project_id
]
if
filters
.
key?
(
'project_id'
)
project_ids
=
vulnerable
.
is_a?
(
Project
)
?
[
vulnerable
.
id
]
:
[]
group
.
project_ids_with_security_reports
return
filters
[
:project_id
]
+
project_ids
if
filters
.
key?
(
'project_id'
)
vulnerable
.
is_a?
(
Group
)
?
vulnerable
.
project_ids_with_security_reports
:
project_ids
end
end
end
...
...
ee/lib/gitlab/vulnerabilities/summary_cache.rb
View file @
67454bc9
...
...
@@ -3,17 +3,17 @@
module
Gitlab
module
Vulnerabilities
class
SummaryCache
attr_reader
:
group
,
:project_id
attr_reader
:
vulnerable
,
:project_id
def
initialize
(
group
,
project_id
)
@
group
=
group
def
initialize
(
vulnerable
,
project_id
)
@
vulnerable
=
vulnerable
@project_id
=
project_id
end
def
fetch
(
force:
false
)
Rails
.
cache
.
fetch
(
cache_key
,
force:
force
,
expires_in:
1
.
day
)
do
findings
=
::
Security
::
VulnerabilityFindingsFinder
.
new
(
group
,
params:
{
project_id:
[
project_id
]
})
.
new
(
vulnerable
,
params:
{
project_id:
[
project_id
]
})
.
execute
(
:all
)
.
counted_by_severity
...
...
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