Commit ba8a9b5b authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Dmitry Gruzd

Skip failed builds

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/346971
Changelog: changed
EE: true
parent ccf068e5
......@@ -117,10 +117,10 @@ module EE
def 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)
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)
end
end
......
......@@ -267,6 +267,17 @@ RSpec.describe Ci::Pipeline do
expect(subject.dependencies).to be_empty
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
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