Commit 20e38e0d authored by Giorgenes Gelatti's avatar Giorgenes Gelatti

Remove container_registry_smart_delete feature flag

Remove flag and associated code and specs
parent caba5d77
...@@ -9,25 +9,11 @@ module Projects ...@@ -9,25 +9,11 @@ module Projects
tag_names = params[:tags] tag_names = params[:tags]
return error('not tags specified') if tag_names.blank? return error('not tags specified') if tag_names.blank?
if can_use?
smart_delete(container_repository, tag_names) smart_delete(container_repository, tag_names)
else
unsafe_delete(container_repository, tag_names)
end
end end
private private
def unsafe_delete(container_repository, tag_names)
deleted_tags = tag_names.select do |tag_name|
container_repository.tag(tag_name).unsafe_delete
end
return error('could not delete tags') if deleted_tags.empty?
success(deleted: deleted_tags)
end
# Replace a tag on the registry with a dummy tag. # Replace a tag on the registry with a dummy tag.
# This is a hack as the registry doesn't support deleting individual # This is a hack as the registry doesn't support deleting individual
# tags. This code effectively pushes a dummy image and assigns the tag to it. # tags. This code effectively pushes a dummy image and assigns the tag to it.
...@@ -57,10 +43,6 @@ module Projects ...@@ -57,10 +43,6 @@ module Projects
error('could not delete tags') error('could not delete tags')
end end
end end
def can_use?
Feature.enabled?(:container_registry_smart_delete, project, default_enabled: true)
end
end end
end end
end end
...@@ -57,21 +57,7 @@ describe Projects::ContainerRepository::DeleteTagsService do ...@@ -57,21 +57,7 @@ describe Projects::ContainerRepository::DeleteTagsService do
end end
end end
context 'with dummy tags disabled' do context 'with tags to delete' do
let(:tags) { %w[A Ba] }
before do
stub_feature_flags(container_registry_smart_delete: false)
end
it 'deletes tags one by one' do
expect_delete_tag('sha256:configA')
expect_delete_tag('sha256:configB')
is_expected.to include(status: :success)
end
end
context 'with dummy tags enabled' do
let(:tags) { %w[A Ba] } let(:tags) { %w[A Ba] }
it 'deletes the tags using a dummy image' do it 'deletes the tags using a dummy image' 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