Commit 62586dbc authored by Patrick Steinhardt's avatar Patrick Steinhardt

flags: Drop `update_remote_mirror_inmemory` feature flag

The `udpate_remote_mirror_inmemory` feature flag has been enabled by
default since bfdf0dc2 (Default-enable :update_remote_mirror_inmemory
feature flag, 2021-06-23), which has been released as part of v14.1. We
can thus now remove this feature flag altogether.

Changelog: changed
parent c5454a3a
......@@ -100,11 +100,11 @@ class RemoteMirror < ApplicationRecord
update_status == 'started'
end
def update_repository(inmemory_remote:)
def update_repository
Gitlab::Git::RemoteMirror.new(
project.repository.raw,
remote_name,
inmemory_remote ? remote_url : nil,
remote_url,
**options_for_update
).update
end
......
......@@ -43,12 +43,7 @@ module Projects
# LFS objects must be sent first, or the push has dangling pointers
send_lfs_objects!(remote_mirror)
response = if Feature.enabled?(:update_remote_mirror_inmemory, project, default_enabled: :yaml)
remote_mirror.update_repository(inmemory_remote: true)
else
remote_mirror.ensure_remote!
remote_mirror.update_repository(inmemory_remote: false)
end
response = remote_mirror.update_repository
if response.divergent_refs.any?
message = "Some refs have diverged and have not been updated on the remote:"
......
---
name: update_remote_mirror_inmemory
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63962
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333517
milestone: '14.0'
type: development
group: group::gitaly
default_enabled: true
......@@ -157,34 +157,20 @@ RSpec.describe RemoteMirror, :mailer do
end
describe '#update_repository' do
shared_examples 'an update' do
it 'performs update including options' do
git_remote_mirror = stub_const('Gitlab::Git::RemoteMirror', spy)
mirror = build(:remote_mirror)
expect(mirror).to receive(:options_for_update).and_return(keep_divergent_refs: true)
mirror.update_repository(inmemory_remote: inmemory)
expect(git_remote_mirror).to have_received(:new).with(
mirror.project.repository.raw,
mirror.remote_name,
inmemory ? mirror.url : nil,
keep_divergent_refs: true
)
expect(git_remote_mirror).to have_received(:update)
end
end
context 'with inmemory remote' do
let(:inmemory) { true }
it_behaves_like 'an update'
end
context 'with on-disk remote' do
let(:inmemory) { false }
it_behaves_like 'an update'
it 'performs update including options' do
git_remote_mirror = stub_const('Gitlab::Git::RemoteMirror', spy)
mirror = build(:remote_mirror)
expect(mirror).to receive(:options_for_update).and_return(keep_divergent_refs: true)
mirror.update_repository
expect(git_remote_mirror).to have_received(:new).with(
mirror.project.repository.raw,
mirror.remote_name,
mirror.url,
keep_divergent_refs: true
)
expect(git_remote_mirror).to have_received(:update)
end
end
......
......@@ -13,36 +13,21 @@ RSpec.describe Projects::UpdateRemoteMirrorService do
describe '#execute' do
let(:retries) { 0 }
let(:inmemory) { true }
subject(:execute!) { service.execute(remote_mirror, retries) }
before do
stub_feature_flags(update_remote_mirror_inmemory: inmemory)
project.repository.add_branch(project.owner, 'existing-branch', 'master')
allow(remote_mirror)
.to receive(:update_repository)
.with(inmemory_remote: inmemory)
.and_return(double(divergent_refs: []))
end
context 'with in-memory remote disabled' do
let(:inmemory) { false }
it 'does not ensure the remote exists' do
expect(remote_mirror).not_to receive(:ensure_remote!)
it 'ensures the remote exists' do
expect(remote_mirror).to receive(:ensure_remote!)
execute!
end
end
context 'with in-memory remote enabled' do
it 'does not ensure the remote exists' do
expect(remote_mirror).not_to receive(:ensure_remote!)
execute!
end
execute!
end
it 'does not fetch the remote repository' 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