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

Remove container registry on project removal

parent d85b8896
......@@ -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
......
......@@ -31,7 +31,8 @@ module ImageRegistry
end
end
def delete
def delete_tags
return unless tags
tags.each(:delete)
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