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