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
75923f93
Commit
75923f93
authored
Apr 23, 2020
by
mo khan
Committed by
James Lopez
Apr 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
License Compliance: Ignore invalid reports
parent
ca66f712
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
ee/changelogs/unreleased/check-lc-report-schema.yml
ee/changelogs/unreleased/check-lc-report-schema.yml
+5
-0
ee/lib/gitlab/ci/parsers/license_compliance/license_scanning.rb
.../gitlab/ci/parsers/license_compliance/license_scanning.rb
+3
-1
ee/spec/lib/gitlab/ci/parsers/license_compliance/license_scanning_spec.rb
...ab/ci/parsers/license_compliance/license_scanning_spec.rb
+10
-0
No files found.
ee/changelogs/unreleased/check-lc-report-schema.yml
0 → 100644
View file @
75923f93
---
title
:
Ignore invalid license_scanning reports
merge_request
:
30114
author
:
type
:
fixed
ee/lib/gitlab/ci/parsers/license_compliance/license_scanning.rb
View file @
75923f93
...
@@ -10,7 +10,9 @@ module Gitlab
...
@@ -10,7 +10,9 @@ module Gitlab
PARSERS
=
{
'1'
=>
V1
,
'2'
=>
V2
}.
freeze
PARSERS
=
{
'1'
=>
V1
,
'2'
=>
V2
}.
freeze
def
parse!
(
json_data
,
report
)
def
parse!
(
json_data
,
report
)
json
=
JSON
.
parse
(
json_data
,
symbolize_names:
true
)
json
=
JSON
.
parse
(
json_data
,
symbolize_names:
true
,
object_class:
Hash
)
return
unless
json
.
is_a?
(
Hash
)
report
.
version
=
json
[
:version
].
presence
||
DEFAULT_VERSION
report
.
version
=
json
[
:version
].
presence
||
DEFAULT_VERSION
parser
=
PARSERS
.
fetch
(
report
.
major_version
)
parser
=
PARSERS
.
fetch
(
report
.
major_version
)
...
...
ee/spec/lib/gitlab/ci/parsers/license_compliance/license_scanning_spec.rb
View file @
75923f93
...
@@ -162,6 +162,16 @@ describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
...
@@ -162,6 +162,16 @@ describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
it
{
expect
(
report
).
to
be_empty
}
it
{
expect
(
report
).
to
be_empty
}
end
end
context
'when the report is structured as an array'
do
let
(
:invalid_json
)
{
JSON
.
pretty_generate
([])
}
before
do
subject
.
parse!
(
invalid_json
,
report
)
end
it
{
expect
(
report
).
to
be_empty
}
end
context
'when the report is not a valid JSON document'
do
context
'when the report is not a valid JSON document'
do
it
do
it
do
expect
do
expect
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