Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
20e38e0d
Commit
20e38e0d
authored
Oct 24, 2019
by
Giorgenes Gelatti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove container_registry_smart_delete feature flag
Remove flag and associated code and specs
parent
caba5d77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
34 deletions
+2
-34
app/services/projects/container_repository/delete_tags_service.rb
...ices/projects/container_repository/delete_tags_service.rb
+1
-19
spec/services/projects/container_repository/delete_tags_service_spec.rb
...projects/container_repository/delete_tags_service_spec.rb
+1
-15
No files found.
app/services/projects/container_repository/delete_tags_service.rb
View file @
20e38e0d
...
@@ -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
spec/services/projects/container_repository/delete_tags_service_spec.rb
View file @
20e38e0d
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment