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
ebc41742
Commit
ebc41742
authored
Oct 16, 2020
by
mo khan
Committed by
Igor Drozdov
Oct 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide additional dependency metadata
parent
d983ad6a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
31 deletions
+16
-31
ee/app/serializers/license_entity.rb
ee/app/serializers/license_entity.rb
+2
-0
ee/app/serializers/license_scanning_report_dependency_entity.rb
.../serializers/license_scanning_report_dependency_entity.rb
+0
-5
ee/app/serializers/security/license_policy_entity.rb
ee/app/serializers/security/license_policy_entity.rb
+1
-1
ee/changelogs/unreleased/37719-add-dependency-version.yml
ee/changelogs/unreleased/37719-add-dependency-version.yml
+5
-0
ee/spec/controllers/projects/licenses_controller_spec.rb
ee/spec/controllers/projects/licenses_controller_spec.rb
+3
-1
ee/spec/serializers/license_entity_spec.rb
ee/spec/serializers/license_entity_spec.rb
+3
-4
ee/spec/serializers/license_scanning_report_dependency_entity_spec.rb
...alizers/license_scanning_report_dependency_entity_spec.rb
+0
-18
ee/spec/serializers/security/license_policy_entity_spec.rb
ee/spec/serializers/security/license_policy_entity_spec.rb
+2
-2
No files found.
ee/app/serializers/license_entity.rb
View file @
ebc41742
...
...
@@ -3,6 +3,8 @@
class
LicenseEntity
<
Grape
::
Entity
class
ComponentEntity
<
Grape
::
Entity
expose
:name
expose
:version
expose
:package_manager
expose
:blob_path
do
|
model
,
options
|
model
.
blob_path_for
(
options
[
:project
])
end
...
...
ee/app/serializers/license_scanning_report_dependency_entity.rb
deleted
100644 → 0
View file @
d983ad6a
# frozen_string_literal: true
class
LicenseScanningReportDependencyEntity
<
Grape
::
Entity
expose
:name
end
ee/app/serializers/security/license_policy_entity.rb
View file @
ebc41742
...
...
@@ -3,7 +3,7 @@
module
Security
class
LicensePolicyEntity
<
Grape
::
Entity
expose
:name
expose
:dependencies
,
using:
LicenseScanningReportDependency
Entity
expose
:dependencies
,
using:
::
LicenseEntity
::
Component
Entity
expose
:url
expose
:classification
do
|
entity
|
...
...
ee/changelogs/unreleased/37719-add-dependency-version.yml
0 → 100644
View file @
ebc41742
---
title
:
Provide dependency version data for the License Compliance page
merge_request
:
44839
author
:
type
:
added
ee/spec/controllers/projects/licenses_controller_spec.rb
View file @
ebc41742
...
...
@@ -82,7 +82,9 @@ RSpec.describe Projects::LicensesController do
'url'
=>
'http://www.apache.org/licenses/LICENSE-2.0.txt'
,
'components'
=>
[{
"blob_path"
=>
nil
,
"name"
=>
"thread_safe"
"name"
=>
"thread_safe"
,
"package_manager"
=>
nil
,
"version"
=>
nil
}]
})
end
...
...
ee/spec/serializers/license_entity_spec.rb
View file @
ebc41742
...
...
@@ -9,11 +9,10 @@ RSpec.describe LicenseEntity do
let
(
:license
)
{
build
(
:license_scanning_license
,
:mit
)
}
let
(
:license_policy
)
{
::
SCA
::
LicensePolicy
.
new
(
license
,
software_policy
)
}
let
(
:software_policy
)
{
build
(
:software_license_policy
)
}
let
(
:path
)
{
'
some_path
'
}
let
(
:path
)
{
'
./Gemfile.lock
'
}
before
do
license
.
add_dependency
(
name:
'rails'
)
allow
(
license
.
dependencies
.
first
).
to
receive
(
:path
).
and_return
(
path
)
license
.
add_dependency
(
name:
'rails'
,
package_manager:
'bundler'
,
path:
path
,
version:
'6.0.3.4'
)
end
it
"produces the correct representation"
do
...
...
@@ -23,7 +22,7 @@ RSpec.describe LicenseEntity do
url:
license_policy
.
url
,
spdx_identifier:
license_policy
.
spdx_identifier
,
classification:
license_policy
.
classification
,
components:
[{
name:
'rails'
,
blob_path:
path
}]
components:
[{
name:
'rails'
,
package_manager:
'bundler'
,
version:
'6.0.3.4'
,
blob_path:
path
}]
})
end
...
...
ee/spec/serializers/license_scanning_report_dependency_entity_spec.rb
deleted
100644 → 0
View file @
d983ad6a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
LicenseScanningReportDependencyEntity
do
include
LicenseScanningReportHelper
let
(
:dependency
)
{
create_dependency
}
let
(
:entity
)
{
described_class
.
new
(
dependency
)
}
describe
'#as_json'
do
subject
{
entity
.
as_json
}
it
'contains the correct dependency name'
do
expect
(
subject
[
:name
]).
to
eq
(
'Dependency1'
)
end
end
end
ee/spec/serializers/security/license_policy_entity_spec.rb
View file @
ebc41742
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
Security
::
LicensePolicyEntity
do
let
(
:license
)
{
build
(
:license_scanning_license
,
:mit
).
tap
{
|
x
|
x
.
add_dependency
(
name:
'rails'
)
}
}
let
(
:license
)
{
build
(
:license_scanning_license
,
:mit
).
tap
{
|
x
|
x
.
add_dependency
(
name:
'rails'
,
package_manager:
'bundler'
,
path:
'./Gemfile.lock'
,
version:
'6.0.3.4'
)
}
}
let
(
:policy
)
{
build
(
:software_license_policy
,
:allowed
)
}
let
(
:entity
)
{
described_class
.
new
(
SCA
::
LicensePolicy
.
new
(
license
,
policy
))
}
...
...
@@ -12,7 +12,7 @@ RSpec.describe Security::LicensePolicyEntity do
specify
{
expect
(
subject
[
:name
]).
to
eql
(
policy
.
name
)
}
specify
{
expect
(
subject
[
:classification
]).
to
eql
({
id:
policy
.
id
,
name:
policy
.
name
,
approval_status:
policy
.
approval_status
})
}
specify
{
expect
(
subject
[
:dependencies
]).
to
match_array
([{
name:
'rails'
}])
}
specify
{
expect
(
subject
[
:dependencies
]).
to
match_array
([{
name:
'rails'
,
package_manager:
'bundler'
,
version:
'6.0.3.4'
,
blob_path:
'./Gemfile.lock'
}])
}
specify
{
expect
(
subject
[
:count
]).
to
be
(
1
)
}
specify
{
expect
(
subject
[
:url
]).
to
eql
(
license
.
url
)
}
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