Commit 5331a5d3 authored by Shinya Maeda's avatar Shinya Maeda

Remove ci_always_refresh_merge_requests_from_beginning flag

This commit removes the feature flag.
parent 325aceb0
---
title: Make the Merge Train process flow more resilient by always refreshing merge
requests from beginning
merge_request: 46768
author:
type: fixed
---
name: ci_always_refresh_merge_requests_from_beginning
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45232
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268215
milestone: '13.5'
type: development
group: group::continuous integration
default_enabled: false
......@@ -42,12 +42,13 @@ module MergeTrains
attr_reader :merge_request
# NOTE:
# As we changed the process flow to refresh merge requests from the begnning always,
# we don't use the `items` argument anymore.
# We should refactor the current logic to make this class more readable.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/281065
def get_first_in_train(items)
if Feature.enabled?(:ci_always_refresh_merge_requests_from_beginning, merge_request.target_project)
MergeTrain.first_in_train(merge_request.target_project, merge_request.target_branch)
else
MergeTrain.first_in_train_from(items)
end
MergeTrain.first_in_train(merge_request.target_project, merge_request.target_branch)
end
def unsafe_refresh(first_merge_request)
......
......@@ -181,62 +181,6 @@ RSpec.describe MergeTrains::RefreshMergeRequestsService do
subject
end
context 'when ci_always_refresh_merge_requests_from_beginning is disabled' do
before do
stub_feature_flags(ci_always_refresh_merge_requests_from_beginning: false)
end
it 'executes RefreshMergeRequestService to all the following merge requests' do
expect(refresh_service_1).not_to receive(:execute).with(merge_request_1)
expect(refresh_service_2).to receive(:execute).with(merge_request_2)
subject
end
context 'when merge request 1 was tried to be refreshed while the system is refreshing merge request 2' do
before do
allow_any_instance_of(described_class).to receive(:unsafe_refresh).with(merge_request_2) do
service.execute(merge_request_1)
end
end
it 'refreshes the merge request 1 later with AutoMergeProcessWorker' do
expect(AutoMergeProcessWorker).to receive(:perform_async).with(merge_request_1.id).once
subject
end
context 'when ci_always_refresh_merge_requests_from_beginning is disabled' do
before do
stub_feature_flags(ci_always_refresh_merge_requests_from_beginning: false)
end
it 'refreshes the merge request 1 later with AutoMergeProcessWorker' do
expect(AutoMergeProcessWorker).to receive(:perform_async).with(merge_request_1.id).once
subject
end
end
it_behaves_like 'logging results', 4
context 'when merge request 1 has already been merged' do
before do
allow(merge_request_1.merge_train).to receive(:cleanup_ref)
merge_request_1.merge_train.update_column(:status, MergeTrain.state_machines[:status].states[:merged].value)
end
it 'does not refresh the merge request 1' do
expect(AutoMergeProcessWorker).not_to receive(:perform_async).with(merge_request_1.id)
subject
end
it_behaves_like 'logging results', 1
end
end
end
it_behaves_like 'logging results', 3
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