Commit ede40667 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Cleanup feature flag gitaly_tags_finder

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/339741

Remove FF `gitaly_tags_finder` and deprecated code

Changelog: other
parent 969e92bc
......@@ -732,9 +732,7 @@ class Repository
end
def tags_sorted_by(value, pagination_params = nil)
return raw_repository.tags(sort_by: value, pagination_params: pagination_params) if Feature.enabled?(:tags_finder_gitaly, project, default_enabled: :yaml)
tags_ruby_sort(value)
raw_repository.tags(sort_by: value, pagination_params: pagination_params)
end
# Params:
......@@ -1170,34 +1168,6 @@ class Repository
@request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore)
end
# Deprecated: https://gitlab.com/gitlab-org/gitlab/-/issues/339741
def tags_ruby_sort(value)
case value
when 'name_asc'
VersionSorter.sort(tags) { |tag| tag.name }
when 'name_desc'
VersionSorter.rsort(tags) { |tag| tag.name }
when 'updated_desc'
tags_sorted_by_committed_date.reverse
when 'updated_asc'
tags_sorted_by_committed_date
else
tags
end
end
# Deprecated: https://gitlab.com/gitlab-org/gitlab/-/issues/339741
def tags_sorted_by_committed_date
# Annotated tags can point to any object (e.g. a blob), but generally
# tags point to a commit. If we don't have a commit, then just default
# to putting the tag at the end of the list.
default = Time.current
tags.sort_by do |tag|
tag.dereferenced_target&.committed_date || default
end
end
def repository_event(event, tags = {})
Gitlab::Metrics.add_event(event, tags)
end
......
---
name: tags_finder_gitaly
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69101
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339741
milestone: '14.3'
type: development
group: group::source code
default_enabled: true
......@@ -68,22 +68,11 @@ RSpec.describe Repository do
describe '#tags_sorted_by' do
let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
let(:feature_flag) { true }
before do
stub_feature_flags(tags_finder_gitaly: feature_flag)
end
context 'name_desc' do
subject { repository.tags_sorted_by('name_desc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.1.0', 'v1.0.0']) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(['v1.1.0', 'v1.0.0']) }
end
end
context 'name_asc' do
......@@ -93,12 +82,6 @@ RSpec.describe Repository do
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
end
context 'with pagination' do
context 'with limit' do
let(:pagination_params) { { limit: 1 } }
......@@ -153,24 +136,12 @@ RSpec.describe Repository do
subject { repository.tags_sorted_by('updated_desc').map(&:name) & (tags_to_compare + [latest_tag]) }
it { is_expected.to eq([latest_tag, 'v1.1.0', 'v1.0.0']) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq([latest_tag, 'v1.1.0', 'v1.0.0']) }
end
end
context 'asc' do
subject { repository.tags_sorted_by('updated_asc').map(&:name) & (tags_to_compare + [latest_tag]) }
it { is_expected.to eq(['v1.0.0', 'v1.1.0', latest_tag]) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(['v1.0.0', 'v1.1.0', latest_tag]) }
end
end
context 'annotated tag pointing to a blob' do
......@@ -187,12 +158,6 @@ RSpec.describe Repository do
it { is_expected.to eq(['v1.0.0', 'v1.1.0', annotated_tag_name]) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(['v1.0.0', 'v1.1.0', annotated_tag_name]) }
end
after do
rugged_repo(repository).tags.delete(annotated_tag_name)
end
......@@ -203,12 +168,6 @@ RSpec.describe Repository do
subject { repository.tags_sorted_by('unknown_desc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
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