Welcome to mirror list, hosted at ThFree Co, Russian Federation.

expire_build_instance_artifacts_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 948e1a59b07bef2dc8344d02ac7d9aea60a53258 (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
# frozen_string_literal: true

class ExpireBuildInstanceArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
  include ApplicationWorker

  data_consistency :always

  sidekiq_options retry: 3

  feature_category :build_artifacts

  def perform(build_id)
    # rubocop: disable CodeReuse/ActiveRecord
    build = Ci::Build
      .with_expired_artifacts
      .reorder(nil)
      .find_by_id(build_id)
    # rubocop: enable CodeReuse/ActiveRecord

    return unless build&.project && !build.project.pending_delete

    Gitlab::AppLogger.info("Removing artifacts for build #{build.id}...")
    build.erase_erasable_artifacts!
  end
end