2019-01-10 14:22:58 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-10-26 18:08:27 +00:00
|
|
|
class CleanupContainerRepositoryWorker
|
2019-01-10 14:22:58 +00:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2019-01-10 14:22:58 +00:00
|
|
|
queue_namespace :container_repository
|
2019-10-18 11:11:44 +00:00
|
|
|
feature_category :container_registry
|
2020-10-26 18:08:27 +00:00
|
|
|
urgency :low
|
|
|
|
worker_resource_boundary :unknown
|
|
|
|
idempotent!
|
2020-06-12 12:08:56 +00:00
|
|
|
loggable_arguments 2
|
2019-01-10 14:22:58 +00:00
|
|
|
|
|
|
|
attr_reader :container_repository, :current_user
|
|
|
|
|
|
|
|
def perform(current_user_id, container_repository_id, params)
|
|
|
|
@current_user = User.find_by_id(current_user_id)
|
|
|
|
@container_repository = ContainerRepository.find_by_id(container_repository_id)
|
2020-02-13 15:08:52 +00:00
|
|
|
@params = params
|
2019-01-10 14:22:58 +00:00
|
|
|
|
|
|
|
return unless valid?
|
|
|
|
|
2022-05-02 21:09:12 +00:00
|
|
|
Projects::ContainerRepository::CleanupTagsService
|
2022-09-17 00:10:28 +00:00
|
|
|
.new(container_repository: container_repository, current_user: current_user, params: params)
|
2021-10-07 12:12:09 +00:00
|
|
|
.execute
|
2019-01-10 14:22:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def valid?
|
|
|
|
current_user && container_repository && project
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
|
|
|
container_repository&.project
|
|
|
|
end
|
|
|
|
end
|