Commit 115708d8 authored by Robert Speicher's avatar Robert Speicher

Remove the keep_divergent_refs feature flag

This feature is now generally available.
parent 4ca162db
- protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|') - protocols = Gitlab::UrlSanitizer::ALLOWED_SCHEMES.join('|')
- keep_divergent_refs = Feature.enabled?(:keep_divergent_refs, @project)
= f.fields_for :remote_mirrors, @project.remote_mirrors.build do |rm_f| = f.fields_for :remote_mirrors, @project.remote_mirrors.build do |rm_f|
= rm_f.hidden_field :enabled, value: '1' = rm_f.hidden_field :enabled, value: '1'
= rm_f.hidden_field :url, class: 'js-mirror-url-hidden', required: true, pattern: "(#{protocols}):\/\/.+" = rm_f.hidden_field :url, class: 'js-mirror-url-hidden', required: true, pattern: "(#{protocols}):\/\/.+"
= rm_f.hidden_field :only_protected_branches, class: 'js-mirror-protected-hidden' = rm_f.hidden_field :only_protected_branches, class: 'js-mirror-protected-hidden'
- if keep_divergent_refs
= rm_f.hidden_field :keep_divergent_refs, class: 'js-mirror-keep-divergent-refs-hidden' = rm_f.hidden_field :keep_divergent_refs, class: 'js-mirror-keep-divergent-refs-hidden'
= render partial: 'projects/mirrors/ssh_host_keys', locals: { f: rm_f } = render partial: 'projects/mirrors/ssh_host_keys', locals: { f: rm_f }
= render partial: 'projects/mirrors/authentication_method', locals: { f: rm_f } = render partial: 'projects/mirrors/authentication_method', locals: { f: rm_f }
- if keep_divergent_refs
.form-check.append-bottom-10 .form-check.append-bottom-10
= check_box_tag :keep_divergent_refs, '1', false, class: 'js-mirror-keep-divergent-refs form-check-input' = check_box_tag :keep_divergent_refs, '1', false, class: 'js-mirror-keep-divergent-refs form-check-input'
= label_tag :keep_divergent_refs, 'Keep divergent refs', class: 'form-check-label' = label_tag :keep_divergent_refs, 'Keep divergent refs', class: 'form-check-label'
---
title: Add "Keep divergent refs" option for push mirrors
merge_request: 32381
author:
type: added
...@@ -12,9 +12,7 @@ module API ...@@ -12,9 +12,7 @@ module API
expose :last_successful_update_at expose :last_successful_update_at
expose :last_error expose :last_error
expose :only_protected_branches expose :only_protected_branches
expose :keep_divergent_refs, if: -> (mirror, _options) do expose :keep_divergent_refs
::Feature.enabled?(:keep_divergent_refs, mirror.project)
end
end end
end end
end end
...@@ -34,7 +34,6 @@ module API ...@@ -34,7 +34,6 @@ module API
end end
post ':id/remote_mirrors' do post ':id/remote_mirrors' do
create_params = declared_params(include_missing: false) create_params = declared_params(include_missing: false)
create_params.delete(:keep_divergent_refs) unless ::Feature.enabled?(:keep_divergent_refs, user_project)
new_mirror = user_project.remote_mirrors.create(create_params) new_mirror = user_project.remote_mirrors.create(create_params)
...@@ -59,7 +58,6 @@ module API ...@@ -59,7 +58,6 @@ module API
mirror_params = declared_params(include_missing: false) mirror_params = declared_params(include_missing: false)
mirror_params[:id] = mirror_params.delete(:mirror_id) mirror_params[:id] = mirror_params.delete(:mirror_id)
mirror_params.delete(:keep_divergent_refs) unless ::Feature.enabled?(:keep_divergent_refs, user_project)
update_params = { remote_mirrors_attributes: mirror_params } update_params = { remote_mirrors_attributes: mirror_params }
......
...@@ -222,20 +222,6 @@ describe 'Projects > Settings > Repository settings' do ...@@ -222,20 +222,6 @@ describe 'Projects > Settings > Repository settings' do
end end
end end
# Removal: https://gitlab.com/gitlab-org/gitlab/-/issues/208828
context 'with the `keep_divergent_refs` feature flag disabled' do
before do
stub_feature_flags(keep_divergent_refs: false)
end
it 'hides the "Keep divergent refs" option' do
visit project_settings_repository_path(project)
expect(page).not_to have_selector('#keep_divergent_refs')
expect(page).not_to have_text('Keep divergent refs')
end
end
context 'repository cleanup settings' do context 'repository cleanup settings' do
let(:object_map_file) { Rails.root.join('spec', 'fixtures', 'bfg_object_map.txt') } let(:object_map_file) { Rails.root.join('spec', 'fixtures', 'bfg_object_map.txt') }
......
...@@ -78,10 +78,6 @@ describe API::RemoteMirrors do ...@@ -78,10 +78,6 @@ describe API::RemoteMirrors do
let(:route) { ->(id) { "/projects/#{project.id}/remote_mirrors/#{id}" } } let(:route) { ->(id) { "/projects/#{project.id}/remote_mirrors/#{id}" } }
let(:mirror) { project.remote_mirrors.first } let(:mirror) { project.remote_mirrors.first }
before do
stub_feature_flags(keep_divergent_refs: false)
end
it 'requires `admin_remote_mirror` permission' do it 'requires `admin_remote_mirror` permission' do
put api(route[mirror.id], developer) put api(route[mirror.id], developer)
...@@ -100,24 +96,7 @@ describe API::RemoteMirrors do ...@@ -100,24 +96,7 @@ describe API::RemoteMirrors do
expect(response).to have_gitlab_http_status(:success) expect(response).to have_gitlab_http_status(:success)
expect(json_response['enabled']).to eq(false) expect(json_response['enabled']).to eq(false)
expect(json_response['only_protected_branches']).to eq(true) expect(json_response['only_protected_branches']).to eq(true)
# Deleted due to lack of feature availability
expect(json_response['keep_divergent_refs']).to be_nil
end
context 'with the `keep_divergent_refs` feature enabled' do
before do
stub_feature_flags(keep_divergent_refs: project)
end
it 'updates the `keep_divergent_refs` attribute' do
project.add_maintainer(user)
put api(route[mirror.id], user), params: { keep_divergent_refs: 'true' }
expect(response).to have_gitlab_http_status(:success)
expect(json_response['keep_divergent_refs']).to eq(true) expect(json_response['keep_divergent_refs']).to eq(true)
end end
end 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