Commit 16c7a51a authored by Mark Florian's avatar Mark Florian Committed by Douglas Barbosa Alexandre

Remove code for unsupported license_management

Support for the `license_management` artifact/scanner was dropped in
13.0 (see https://gitlab.com/groups/gitlab-org/-/epics/659), but this
code was left over, and is now effectively a no-op. This simply removes
that code.

Addresses part of https://gitlab.com/gitlab-org/gitlab/-/issues/8912.
parent 10aef600
......@@ -12,7 +12,7 @@
module Security
class LicenseComplianceJobsFinder < JobsFinder
def self.allowed_job_types
[:license_management, :license_scanning]
[:license_scanning]
end
end
end
......@@ -14,7 +14,6 @@ module Projects
dast: 'user/application_security/dast/index',
dast_profiles: 'user/application_security/dast/index',
dependency_scanning: 'user/application_security/dependency_scanning/index',
license_management: 'user/compliance/license_compliance/index',
license_scanning: 'user/compliance/license_compliance/index',
sast: 'user/application_security/sast/index',
secret_detection: 'user/application_security/secret_detection/index',
......@@ -28,7 +27,6 @@ module Projects
dast: _('Analyze a review version of your web application.'),
dast_profiles: _('Saved scan settings and target site settings which are reusable.'),
dependency_scanning: _('Analyze your dependencies for known vulnerabilities.'),
license_management: _('Search your project dependencies for their licenses and apply policies.'),
license_scanning: _('Search your project dependencies for their licenses and apply policies.'),
sast: _('Analyze your source code for known vulnerabilities.'),
secret_detection: _('Analyze your source code and git history for secrets.'),
......@@ -43,7 +41,6 @@ module Projects
dast: _('Dynamic Application Security Testing (DAST)'),
dast_profiles: _('DAST Scans'),
dependency_scanning: _('Dependency Scanning'),
license_management: 'License Management',
license_scanning: _('License Compliance'),
sast: _('Static Application Security Testing (SAST)'),
secret_detection: _('Secret Detection'),
......@@ -113,9 +110,6 @@ module Projects
end
end
# TODO: remove this line with #8912
license_compliance_substitute(scans)
dast_profiles_insert(scans)
end
......@@ -125,26 +119,6 @@ module Projects
project_pipeline_path(self, latest_default_branch_pipeline)
end
# In this method we define if License Compliance feature is configured
# by looking into `license_scanning` and `license_management` reports
# in 13.0 support for `license_management` report type is scheduled to be dropped.
# With this change we won't need this method anymore.
def license_compliance_substitute(scans)
license_management = scans.find { |scan_type| scan_type[:name] == localized_scan_names[:license_management] }
license_compliance_config = license_management.fetch(:configured, false)
scans.delete(license_management)
if license_compliance_config
scans.map do |scan_type|
scan_type[:configured] = true if scan_type[:name] == _('License Compliance')
scan_type[:status] = s_('SecurityConfiguration|Enabled') if scan_type[:name] == _('License Compliance')
end
end
scans
end
# DAST On-demand scans is a static (non job) entry. Add it manually following DAST
def dast_profiles_insert(scans)
index = scans.index { |scan| scan[:name] == localized_scan_names[:dast] }
......
......@@ -475,7 +475,7 @@ FactoryBot.define do
trait :license_scanning do
options do
{
artifacts: { reports: { license_management: 'gl-license-scanning-report.json' } }
artifacts: { reports: { license_scanning: 'gl-license-scanning-report.json' } }
}
end
end
......
......@@ -15,10 +15,9 @@ RSpec.describe Security::LicenseComplianceJobsFinder do
let!(:container_scanning_build) { create(:ci_build, :container_scanning, pipeline: pipeline) }
let!(:dast_build) { create(:ci_build, :dast, pipeline: pipeline) }
let!(:license_scanning_build) { create(:ci_build, :license_scanning, pipeline: pipeline) }
let!(:license_management_build) { create(:ci_build, :license_management, pipeline: pipeline) }
it 'returns only the license_scanning jobs' do
is_expected.to contain_exactly(license_scanning_build, license_management_build)
it 'returns only the license_scanning job' do
is_expected.to contain_exactly(license_scanning_build)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment