summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-04 14:35:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-04 14:35:18 +0200
commit7168493e8a25836dc7eedf25ec3241afd0d501b8 (patch)
tree62b64574c1f560b82ce87ca83a4f830519f870cc
parentd85b88962b603d46672ed6ebd01955ca7560fcc6 (diff)
downloadgitlab-ce-7168493e8a25836dc7eedf25ec3241afd0d501b8.tar.gz
Remove container registry on project removal
-rw-r--r--app/services/projects/destroy_service.rb8
-rw-r--r--lib/image_registry/repository.rb3
2 files changed, 10 insertions, 1 deletions
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb
index df5054f08d7..70bfc1fd533 100644
--- a/app/services/projects/destroy_service.rb
+++ b/app/services/projects/destroy_service.rb
@@ -28,6 +28,10 @@ module Projects
Project.transaction do
project.destroy!
+ unless remove_registry_tags
+ raise_error('Failed to remove project image registry. Please try again or contact administrator')
+ end
+
unless remove_repository(repo_path)
raise_error('Failed to remove project repository. Please try again or contact administrator')
end
@@ -61,6 +65,10 @@ module Projects
end
end
+ def remove_registry_tags
+ project.image_registry.delete_tags
+ end
+
def raise_error(message)
raise DestroyError.new(message)
end
diff --git a/lib/image_registry/repository.rb b/lib/image_registry/repository.rb
index f4f4ba65afc..c45fa2911e7 100644
--- a/lib/image_registry/repository.rb
+++ b/lib/image_registry/repository.rb
@@ -31,7 +31,8 @@ module ImageRegistry
end
end
- def delete
+ def delete_tags
+ return unless tags
tags.each(:delete)
end
end