Commit b7f1f5ac authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch...

Merge branch '331715-follow-up-from-drop-builds-that-don-t-match-runners-or-have-exceeded-their-quota' into 'master'

Remove retried builds from `pipeline.build_matchers`

See merge request gitlab-org/gitlab!64076
parents 7a74d360 b2bb0196
......@@ -1257,7 +1257,7 @@ module Ci
end
def build_matchers
self.builds.build_matchers(project)
self.builds.latest.build_matchers(project)
end
private
......
......@@ -4625,8 +4625,11 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end
describe '#build_matchers' do
let_it_be(:pipeline) { create(:ci_pipeline) }
let_it_be(:builds) { create_list(:ci_build, 2, pipeline: pipeline, project: pipeline.project) }
let_it_be(:user) { create(:user) }
let_it_be(:pipeline) { create(:ci_pipeline, user: user) }
let_it_be(:builds) { create_list(:ci_build, 2, pipeline: pipeline, project: pipeline.project, user: user) }
let(:project) { pipeline.project }
subject(:matchers) { pipeline.build_matchers }
......@@ -4635,5 +4638,22 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
expect(matchers).to all be_a(Gitlab::Ci::Matching::BuildMatcher)
expect(matchers.first.build_ids).to match_array(builds.map(&:id))
end
context 'with retried builds' do
let(:retried_build) { builds.first }
before do
stub_not_protect_default_branch
project.add_developer(user)
retried_build.cancel!
::Ci::Build.retry(retried_build, user)
end
it 'does not include retried builds' do
expect(matchers.size).to eq(1)
expect(matchers.first.build_ids).not_to include(retried_build.id)
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