Commit 21a5ce7d authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch '346971-skip-failed-builds' into 'master'

Skip failed builds when parsing dependency list

See merge request gitlab-org/gitlab!78218
parents e9a052c0 ba8a9b5b
...@@ -117,10 +117,10 @@ module EE ...@@ -117,10 +117,10 @@ module EE
def dependency_list_report def dependency_list_report
::Gitlab::Ci::Reports::DependencyList::Report.new.tap do |dependency_list_report| ::Gitlab::Ci::Reports::DependencyList::Report.new.tap do |dependency_list_report|
latest_report_builds(::Ci::JobArtifact.dependency_list_reports).each do |build| latest_report_builds(::Ci::JobArtifact.dependency_list_reports).success.each do |build|
build.collect_dependency_list_reports!(dependency_list_report) build.collect_dependency_list_reports!(dependency_list_report)
end end
latest_report_builds(::Ci::JobArtifact.license_scanning_reports).each do |build| latest_report_builds(::Ci::JobArtifact.license_scanning_reports).success.each do |build|
build.collect_licenses_for_dependency_list!(dependency_list_report) build.collect_licenses_for_dependency_list!(dependency_list_report)
end end
end end
......
...@@ -267,6 +267,17 @@ RSpec.describe Ci::Pipeline do ...@@ -267,6 +267,17 @@ RSpec.describe Ci::Pipeline do
expect(subject.dependencies).to be_empty expect(subject.dependencies).to be_empty
end end
end end
context 'with failed builds' do
it 'does not runs queries on failed builds' do
control_count = ActiveRecord::QueryRecorder.new { subject }.count
create(:ee_ci_build, :failed, :dependency_scanning, pipeline: pipeline, project: project)
create(:ee_ci_build, :failed, :license_scanning, pipeline: pipeline, project: project)
expect { subject }.not_to exceed_query_limit(control_count)
end
end
end end
context 'when pipeline does not have any builds with dependency_list reports' do context 'when pipeline does not have any builds with dependency_list reports' do
......
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