diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-04 14:35:18 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-04 14:35:18 +0200 |
commit | 7168493e8a25836dc7eedf25ec3241afd0d501b8 (patch) | |
tree | 62b64574c1f560b82ce87ca83a4f830519f870cc | |
parent | d85b88962b603d46672ed6ebd01955ca7560fcc6 (diff) | |
download | gitlab-ce-7168493e8a25836dc7eedf25ec3241afd0d501b8.tar.gz |
Remove container registry on project removal
-rw-r--r-- | app/services/projects/destroy_service.rb | 8 | ||||
-rw-r--r-- | lib/image_registry/repository.rb | 3 |
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 |