Commit 7c73f9d3 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Rename license_management_report in pipeline

parent 72ea8193
...@@ -31,7 +31,7 @@ module EE ...@@ -31,7 +31,7 @@ module EE
if report_exists if report_exists
format.html { render_show } format.html { render_show }
format.json do format.json do
data = LicenseManagementReportsSerializer.new(project: project, current_user: current_user).represent(pipeline&.license_management_report&.licenses) data = LicenseManagementReportsSerializer.new(project: project, current_user: current_user).represent(pipeline&.license_scanning_report&.licenses)
render json: data, status: :ok render json: data, status: :ok
end end
else else
......
...@@ -135,7 +135,7 @@ class ApprovalMergeRequestRule < ApplicationRecord ...@@ -135,7 +135,7 @@ class ApprovalMergeRequestRule < ApplicationRecord
end end
def refresh_license_management_approvals(project_approval_rule) def refresh_license_management_approvals(project_approval_rule)
license_report = merge_request.head_pipeline&.license_management_report license_report = merge_request.head_pipeline&.license_scanning_report
return if license_report.blank? return if license_report.blank?
if license_report.violates?(project.software_license_policies) if license_report.violates?(project.software_license_policies)
......
...@@ -133,7 +133,7 @@ module EE ...@@ -133,7 +133,7 @@ module EE
end end
end end
def license_management_report def license_scanning_report
::Gitlab::Ci::Reports::LicenseScanning::Report.new.tap do |license_management_report| ::Gitlab::Ci::Reports::LicenseScanning::Report.new.tap do |license_management_report|
builds.latest.with_reports(::Ci::JobArtifact.license_management_reports).each do |build| builds.latest.with_reports(::Ci::JobArtifact.license_management_reports).each do |build|
build.collect_license_scanning_reports!(license_management_report) build.collect_license_scanning_reports!(license_management_report)
......
...@@ -11,7 +11,7 @@ module Ci ...@@ -11,7 +11,7 @@ module Ci
end end
def get_report(pipeline) def get_report(pipeline)
pipeline&.license_management_report pipeline&.license_scanning_report
end end
end end
end end
...@@ -8,7 +8,7 @@ module Security ...@@ -8,7 +8,7 @@ module Security
end end
def execute def execute
pipeline.license_management_report.licenses pipeline.license_scanning_report.licenses
end end
private private
......
...@@ -29,7 +29,7 @@ module Security ...@@ -29,7 +29,7 @@ module Security
def sync_license_management_rules def sync_license_management_rules
project = pipeline.project project = pipeline.project
report = pipeline.license_management_report report = pipeline.license_scanning_report
return if report.empty? && !pipeline.complete? return if report.empty? && !pipeline.complete?
return if report.violates?(project.software_license_policies) return if report.violates?(project.software_license_policies)
......
...@@ -285,13 +285,13 @@ describe Projects::PipelinesController do ...@@ -285,13 +285,13 @@ describe Projects::PipelinesController do
end end
it 'will return license management report in json format' do it 'will return license management report in json format' do
expect(payload.size).to eq(pipeline.license_management_report.licenses.size) expect(payload.size).to eq(pipeline.license_scanning_report.licenses.size)
expect(payload.first.keys).to eq(%w(name classification dependencies count url)) expect(payload.first.keys).to eq(%w(name classification dependencies count url))
end end
it 'will return mit license approved status' do it 'will return mit license approved status' do
payload_mit = payload.find { |l| l['name'] == 'MIT' } payload_mit = payload.find { |l| l['name'] == 'MIT' }
expect(payload_mit['count']).to eq(pipeline.license_management_report.found_licenses['MIT'].count) expect(payload_mit['count']).to eq(pipeline.license_scanning_report.found_licenses['MIT'].count)
expect(payload_mit['url']).to eq('http://opensource.org/licenses/mit-license') expect(payload_mit['url']).to eq('http://opensource.org/licenses/mit-license')
expect(payload_mit['classification']['approval_status']).to eq('approved') expect(payload_mit['classification']['approval_status']).to eq('approved')
end end
......
...@@ -321,7 +321,7 @@ describe ApprovalMergeRequestRule do ...@@ -321,7 +321,7 @@ describe ApprovalMergeRequestRule do
context "when the latest license report violates the compliance policy" do context "when the latest license report violates the compliance policy" do
let(:license) { create(:software_license, name: license_report.license_names[0]) } let(:license) { create(:software_license, name: license_report.license_names[0]) }
let(:license_report) { open_pipeline.license_management_report } let(:license_report) { open_pipeline.license_scanning_report }
specify { expect(subject.approvals_required).to be(project_approval_rule.approvals_required) } specify { expect(subject.approvals_required).to be(project_approval_rule.approvals_required) }
end end
......
...@@ -240,7 +240,7 @@ describe Ci::Pipeline do ...@@ -240,7 +240,7 @@ describe Ci::Pipeline do
end end
describe '#license_management_reports' do describe '#license_management_reports' do
subject { pipeline.license_management_report } subject { pipeline.license_scanning_report }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_management: true)
......
...@@ -73,7 +73,7 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do ...@@ -73,7 +73,7 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
context "when a license violates the license compliance policy" do context "when a license violates the license compliance policy" do
let!(:blacklisted_license) { create(:software_license, name: license_name) } let!(:blacklisted_license) { create(:software_license, name: license_name) }
let!(:ci_build) { create(:ee_ci_build, :success, :license_management, pipeline: pipeline, project: project) } let!(:ci_build) { create(:ee_ci_build, :success, :license_management, pipeline: pipeline, project: project) }
let!(:license_name) { ci_build.pipeline.license_management_report.license_names[0] } let!(:license_name) { ci_build.pipeline.license_scanning_report.license_names[0] }
specify { expect { subject }.not_to change { license_compliance_rule.reload.approvals_required } } specify { expect { subject }.not_to change { license_compliance_rule.reload.approvals_required } }
specify { expect(subject[:status]).to be(:success) } specify { expect(subject[:status]).to be(:success) }
......
...@@ -26,7 +26,7 @@ describe RefreshLicenseComplianceChecksWorker do ...@@ -26,7 +26,7 @@ describe RefreshLicenseComplianceChecksWorker do
let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) } let!(:closed_pipeline) { create(:ee_ci_pipeline, :success, :with_license_management_report, project: project, merge_requests_as_head_pipeline: [closed_merge_request]) }
let!(:blacklist_policy) { create(:software_license_policy, project: project, software_license: license, approval_status: :blacklisted) } let!(:blacklist_policy) { create(:software_license_policy, project: project, software_license: license, approval_status: :blacklisted) }
let(:license) { create(:software_license, name: license_report.license_names[0]) } let(:license) { create(:software_license, name: license_report.license_names[0]) }
let(:license_report) { open_pipeline.license_management_report } let(:license_report) { open_pipeline.license_scanning_report }
before do before do
subject.perform(project.id) subject.perform(project.id)
......
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