2018-09-06 06:33:30 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Projects
|
|
|
|
module ContainerRepository
|
|
|
|
class DestroyService < BaseService
|
|
|
|
def execute(container_repository)
|
|
|
|
return false unless can?(current_user, :update_container_image, project)
|
|
|
|
|
2018-09-14 05:02:04 +00:00
|
|
|
# Delete tags outside of the transaction to avoid hitting an idle-in-transaction timeout
|
|
|
|
container_repository.delete_tags!
|
2020-04-07 12:09:34 +00:00
|
|
|
container_repository.delete_failed! unless container_repository.destroy
|
2018-09-06 06:33:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|