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
473553fc
Commit
473553fc
authored
Oct 02, 2020
by
mo khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load license scan data as soon as it is available
* Add changelog entry
parent
ba0277c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
1 deletion
+76
-1
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+4
-0
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+1
-1
ee/changelogs/unreleased/208723-load-licenses-sooner.yml
ee/changelogs/unreleased/208723-load-licenses-sooner.yml
+5
-0
ee/spec/models/ci/pipeline_spec.rb
ee/spec/models/ci/pipeline_spec.rb
+32
-0
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+34
-0
No files found.
ee/app/models/ee/ci/pipeline.rb
View file @
473553fc
...
...
@@ -165,6 +165,10 @@ module EE
.
select
(
&
:failed?
)
end
def
license_scan_completed?
builds
.
latest
.
with_reports
(
::
Ci
::
JobArtifact
.
license_scanning_reports
).
exists?
end
private
def
project_has_subscriptions?
...
...
ee/app/models/ee/merge_request.rb
View file @
473553fc
...
...
@@ -223,7 +223,7 @@ module EE
end
def
compare_license_scanning_reports
(
current_user
)
return
missing_report_error
(
"license scanning"
)
unless
has_license_scanning_reports
?
return
missing_report_error
(
"license scanning"
)
unless
actual_head_pipeline
&
.
license_scan_completed
?
compare_reports
(
::
Ci
::
CompareLicenseScanningReportsService
,
current_user
)
end
...
...
ee/changelogs/unreleased/208723-load-licenses-sooner.yml
0 → 100644
View file @
473553fc
---
title
:
Load license scan data as soon as it is available
merge_request
:
44194
author
:
type
:
fixed
ee/spec/models/ci/pipeline_spec.rb
View file @
473553fc
...
...
@@ -512,4 +512,36 @@ RSpec.describe Ci::Pipeline do
it
{
is_expected
.
to
match_array
(
expected_builds
)
}
end
describe
"#license_scan_completed?"
do
where
(
:pipeline_status
,
:build_types
,
:expected_status
)
do
[
[
:blocked
,
[
:container_scanning
],
false
],
[
:blocked
,
[
:license_scan_v2_1
,
:container_scanning
],
true
],
[
:blocked
,
[
:license_scan_v2_1
],
true
],
[
:blocked
,
[],
false
],
[
:failed
,
[
:container_scanning
],
false
],
[
:failed
,
[
:license_scan_v2_1
,
:container_scanning
],
true
],
[
:failed
,
[
:license_scan_v2_1
],
true
],
[
:failed
,
[],
false
],
[
:running
,
[
:container_scanning
],
false
],
[
:running
,
[
:license_scan_v2_1
,
:container_scanning
],
true
],
[
:running
,
[
:license_scan_v2_1
],
true
],
[
:running
,
[],
false
],
[
:success
,
[
:container_scanning
],
false
],
[
:success
,
[
:license_scan_v2_1
,
:container_scanning
],
true
],
[
:success
,
[
:license_scan_v2_1
],
true
],
[
:success
,
[],
false
]
]
end
with_them
do
subject
{
pipeline
.
license_scan_completed?
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
pipeline_status
,
builds:
builds
)
}
let
(
:builds
)
{
build_types
.
map
{
|
build_type
|
create
(
:ee_ci_build
,
build_type
)
}
}
specify
{
expect
(
subject
).
to
eq
(
expected_status
)
}
end
end
end
ee/spec/models/merge_request_spec.rb
View file @
473553fc
...
...
@@ -728,6 +728,40 @@ RSpec.describe MergeRequest do
expect
(
subject
[
:status_reason
]).
to
eq
(
'This merge request does not have license scanning reports'
)
end
end
context
"when a license scan report is produced from the head pipeline"
do
where
(
:pipeline_status
,
:build_types
,
:expected_status
)
do
[
[
:blocked
,
[
:license_scan_v2_1
],
:parsed
],
[
:blocked
,
[
:container_scanning
],
:error
],
[
:blocked
,
[
:license_scan_v2_1
,
:container_scanning
],
:parsed
],
[
:blocked
,
[],
:error
],
[
:failed
,
[
:container_scanning
],
:error
],
[
:failed
,
[
:license_scan_v2_1
],
:parsed
],
[
:failed
,
[
:license_scan_v2_1
,
:container_scanning
],
:parsed
],
[
:failed
,
[],
:error
],
[
:running
,
[
:container_scanning
],
:error
],
[
:running
,
[
:license_scan_v2_1
],
:parsed
],
[
:running
,
[
:license_scan_v2_1
,
:container_scanning
],
:parsed
],
[
:running
,
[],
:error
],
[
:success
,
[
:container_scanning
],
:error
],
[
:success
,
[
:license_scan_v2_1
],
:parsed
],
[
:success
,
[
:license_scan_v2_1
,
:container_scanning
],
:parsed
],
[
:success
,
[],
:error
]
]
end
with_them
do
let!
(
:head_pipeline
)
{
create
(
:ci_pipeline
,
pipeline_status
,
project:
project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
,
builds:
builds
)
}
let
(
:builds
)
{
build_types
.
map
{
|
build_type
|
create
(
:ee_ci_build
,
build_type
)
}
}
before
do
synchronous_reactive_cache
(
merge_request
)
end
specify
{
expect
(
subject
[
:status
]).
to
eq
(
expected_status
)
}
end
end
end
describe
'#compare_metrics_reports'
do
...
...
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