Commit 7168493e authored by Kamil Trzcinski's avatar Kamil Trzcinski

Remove container registry on project removal

parent d85b8896
...@@ -28,6 +28,10 @@ module Projects ...@@ -28,6 +28,10 @@ module Projects
Project.transaction do Project.transaction do
project.destroy! 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) unless remove_repository(repo_path)
raise_error('Failed to remove project repository. Please try again or contact administrator') raise_error('Failed to remove project repository. Please try again or contact administrator')
end end
...@@ -61,6 +65,10 @@ module Projects ...@@ -61,6 +65,10 @@ module Projects
end end
end end
def remove_registry_tags
project.image_registry.delete_tags
end
def raise_error(message) def raise_error(message)
raise DestroyError.new(message) raise DestroyError.new(message)
end end
......
...@@ -31,7 +31,8 @@ module ImageRegistry ...@@ -31,7 +31,8 @@ module ImageRegistry
end end
end end
def delete def delete_tags
return unless tags
tags.each(:delete) tags.each(:delete)
end 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