debian-mirror-gitlab/app/services/projects/container_repository/destroy_service.rb

16 lines
484 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# 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-12-05 23:21:45 +05:30
# Delete tags outside of the transaction to avoid hitting an idle-in-transaction timeout
container_repository.delete_tags!
2020-04-22 19:07:51 +05:30
container_repository.delete_failed! unless container_repository.destroy
2018-11-20 20:47:30 +05:30
end
end
end
end