Commit d94fc2c6 authored by Robert Speicher's avatar Robert Speicher

Merge branch '13582-get-right-pipeline-for-lc' into 'master'

Change the way of fetching License report

See merge request gitlab-org/gitlab!21545
parents e596e2da b89eb733
...@@ -48,7 +48,7 @@ module SCA ...@@ -48,7 +48,7 @@ module SCA
def pipeline def pipeline
strong_memoize(:pipeline) do strong_memoize(:pipeline) do
project.all_pipelines.latest_successful_for_ref(project.default_branch) project.latest_pipeline_with_reports(::Ci::JobArtifact.license_management_reports)
end end
end end
......
...@@ -184,5 +184,12 @@ RSpec.describe SCA::LicenseCompliance do ...@@ -184,5 +184,12 @@ RSpec.describe SCA::LicenseCompliance do
it { expect(subject.latest_build_for_default_branch).to be_nil } it { expect(subject.latest_build_for_default_branch).to be_nil }
end end
context "when latest pipeline doesn't contain license job" do
let!(:pipeline1) { create(:ci_pipeline, :success, project: project, builds: [license_scan_build]) }
let!(:pipeline2) { create(:ci_pipeline, :success, project: project, builds: [regular_build]) }
it { expect(subject.latest_build_for_default_branch).to eq(license_scan_build) }
end
end 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