summaryrefslogtreecommitdiff
path: root/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb
blob: 004c1d444a295ecc067f9c756f2efc696f405270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Ci
  module PipelineArtifacts
    class ExpireArtifactsWorker
      include ApplicationWorker

      sidekiq_options retry: 3
      # rubocop:disable Scalability/CronWorkerContext
      # This worker does not perform work scoped to a context
      include CronjobQueue
      # rubocop:enable Scalability/CronWorkerContext

      deduplicate :until_executed, including_scheduled: true
      idempotent!
      feature_category :continuous_integration
      tags :exclude_from_kubernetes

      def perform
        service = ::Ci::PipelineArtifacts::DestroyAllExpiredService.new
        artifacts_count = service.execute
        log_extra_metadata_on_done(:destroyed_pipeline_artifacts_count, artifacts_count)
      end
    end
  end
end