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
06253747
Commit
06253747
authored
Oct 24, 2019
by
Can Eldem
Committed by
Rémy Coutable
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invalidate comparison cache when licenses approved or blacklisted
parent
a9e8a9e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
ee/app/models/software_license_policy.rb
ee/app/models/software_license_policy.rb
+4
-0
ee/app/services/ci/compare_license_scanning_reports_service.rb
...p/services/ci/compare_license_scanning_reports_service.rb
+6
-0
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+12
-0
No files found.
ee/app/models/software_license_policy.rb
View file @
06253747
...
...
@@ -43,4 +43,8 @@ class SoftwareLicensePolicy < ApplicationRecord
end
delegate
:name
,
to: :software_license
def
self
.
workaround_cache_key
pluck
(
:id
,
:approval_status
).
flatten
end
end
ee/app/services/ci/compare_license_scanning_reports_service.rb
View file @
06253747
...
...
@@ -13,5 +13,11 @@ module Ci
def
get_report
(
pipeline
)
pipeline
&
.
license_scanning_report
end
private
def
key
(
base_pipeline
,
head_pipeline
)
super
(
base_pipeline
,
head_pipeline
)
+
project
.
software_license_policies
.
workaround_cache_key
end
end
end
ee/spec/models/merge_request_spec.rb
View file @
06253747
...
...
@@ -453,6 +453,18 @@ describe MergeRequest do
subject
end
context
'cache key includes sofware license policies'
do
let!
(
:license_1
)
{
create
(
:software_license_policy
,
project:
project
)
}
let!
(
:license_2
)
{
create
(
:software_license_policy
,
project:
project
)
}
it
'returns key with license information'
do
expect_any_instance_of
(
Ci
::
CompareLicenseScanningReportsService
)
.
to
receive
(
:execute
).
with
(
base_pipeline
,
head_pipeline
).
and_call_original
expect
(
subject
[
:key
]).
to
include
(
*
[
license_1
.
id
,
license_1
.
approval_status
,
license_2
.
id
,
license_2
.
approval_status
])
end
end
context
'when cached results is not latest'
do
before
do
allow_any_instance_of
(
Ci
::
CompareLicenseScanningReportsService
)
...
...
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