Commit f1ef0bd0 authored by Patrick Steinhardt's avatar Patrick Steinhardt

flags: Drop `fetch_remote_params` feature flag

The `fetch_remote_params` feature flag has been enabled by default since
877a101a (Default-enable :fetch_remote_params 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 62586dbc
......@@ -939,17 +939,7 @@ class Repository
end
def fetch_as_mirror(url, forced: false, refmap: :all_refs, remote_name: nil, prune: true)
return fetch_remote(remote_name, url: url, refmap: refmap, forced: forced, prune: prune) if Feature.enabled?(:fetch_remote_params, project, default_enabled: :yaml)
unless remote_name
remote_name = "tmp-#{SecureRandom.hex}"
tmp_remote_name = true
end
add_remote(remote_name, url, mirror_refmap: refmap)
fetch_remote(remote_name, forced: forced, prune: prune)
ensure
async_remove_remote(remote_name) if tmp_remote_name
fetch_remote(remote_name, url: url, refmap: refmap, forced: forced, prune: prune)
end
def async_remove_remote(remote_name)
......
---
name: fetch_remote_params
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/325528
milestone: '13.12'
type: development
group: group::gitaly
default_enabled: true
......@@ -34,8 +34,7 @@ module EE
end
def fetch_upstream(url, forced: false, check_tags_changed: false)
if ::Feature.enabled?(:fetch_remote_params, project, default_enabled: :yaml)
return fetch_remote(
fetch_remote(
MIRROR_REMOTE,
url: url,
refmap: ["+refs/heads/*:refs/remotes/#{MIRROR_REMOTE}/*"],
......@@ -45,11 +44,6 @@ module EE
)
end
add_remote(MIRROR_REMOTE, url)
fetch_remote(MIRROR_REMOTE, ssh_auth: project&.import_data, forced: forced, check_tags_changed: check_tags_changed)
end
def upstream_branches
@upstream_branches ||= remote_branches(MIRROR_REMOTE)
end
......
......@@ -52,7 +52,6 @@ RSpec.describe Repository do
describe '#fetch_upstream' do
let(:url) { "http://example.com" }
context 'when :fetch_remote_params is enabled' do
it 'fetches the URL without creating a remote' do
expect(repository).not_to receive(:add_remote)
expect(repository)
......@@ -64,26 +63,6 @@ RSpec.describe Repository do
end
end
context 'when :fetch_remote_params is disabled' do
before do
stub_feature_flags(fetch_remote_params: false)
end
it 'creates a remote and fetches it' do
expect(repository)
.to receive(:add_remote)
.with(described_class::MIRROR_REMOTE, url)
.and_return(nil)
expect(repository)
.to receive(:fetch_remote)
.with(described_class::MIRROR_REMOTE, ssh_auth: nil, forced: true, check_tags_changed: true)
.and_return(nil)
repository.fetch_upstream(url, forced: true, check_tags_changed: true)
end
end
end
describe '#with_config' do
let(:rugged) { rugged_repo(repository) }
let(:entries) do
......
......@@ -40,11 +40,7 @@ module Gitlab
# updating the timestamp.
project.update_column(:last_repository_updated_at, Time.zone.now)
if Feature.enabled?(:fetch_remote_params, project, default_enabled: :yaml)
project.repository.fetch_remote('github', url: project.import_url, refmap: Gitlab::GithubImport.refmap, forced: false)
else
project.repository.fetch_remote('github', forced: false)
end
pname = project.path_with_namespace
......
......@@ -148,7 +148,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter do
end
end
shared_examples '#update_repository' do
describe '#update_repository' do
it 'updates the repository' do
importer = described_class.new(project, client)
......@@ -162,34 +162,16 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter do
.to receive(:increment)
.and_call_original
freeze_time do
importer.update_repository
expect(project.last_repository_updated_at).to be_like_time(Time.zone.now)
end
end
end
describe '#update_repository with :fetch_remote_params enabled' do
before do
stub_feature_flags(fetch_remote_params: true)
expect(project.repository)
.to receive(:fetch_remote)
.with('github', forced: false, url: url, refmap: Gitlab::GithubImport.refmap)
end
it_behaves_like '#update_repository'
end
freeze_time do
importer.update_repository
describe '#update_repository with :fetch_remote_params disabled' do
before do
stub_feature_flags(fetch_remote_params: false)
expect(project.repository)
.to receive(:fetch_remote)
.with('github', forced: false)
expect(project.last_repository_updated_at).to be_like_time(Time.zone.now)
end
end
it_behaves_like '#update_repository'
end
describe '#update_repository?' do
......
......@@ -1128,14 +1128,8 @@ RSpec.describe Repository do
describe '#fetch_as_mirror' do
let(:url) { "http://example.com" }
context 'when :fetch_remote_params is enabled' do
let(:remote_name) { "remote-name" }
before do
stub_feature_flags(fetch_remote_params: true)
end
it 'fetches the URL without creating a remote' do
expect(repository).not_to receive(:add_remote)
expect(repository)
......@@ -1147,49 +1141,6 @@ RSpec.describe Repository do
end
end
context 'when :fetch_remote_params is disabled' do
before do
stub_feature_flags(fetch_remote_params: false)
end
shared_examples 'a fetch' do
it 'adds and fetches a remote' do
expect(repository)
.to receive(:add_remote)
.with(expected_remote, url, mirror_refmap: :all_refs)
.and_return(nil)
expect(repository)
.to receive(:fetch_remote)
.with(expected_remote, forced: false, prune: true)
.and_return(nil)
repository.fetch_as_mirror(url, remote_name: remote_name)
end
end
context 'with temporary remote' do
let(:remote_name) { nil }
let(:expected_remote_suffix) { "123456" }
let(:expected_remote) { "tmp-#{expected_remote_suffix}" }
before do
expect(repository)
.to receive(:async_remove_remote).with(expected_remote).and_return(nil)
allow(SecureRandom).to receive(:hex).and_return(expected_remote_suffix)
end
it_behaves_like 'a fetch'
end
context 'with remote name' do
let(:remote_name) { "foo" }
let(:expected_remote) { "foo" }
it_behaves_like 'a fetch'
end
end
end
describe '#fetch_ref' do
let(:broken_repository) { create(:project, :broken_storage).repository }
......
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