BigW Consortium Gitlab

expire_build_instance_artifacts_worker.rb 398 Bytes
Newer Older
1 2
class ExpireBuildInstanceArtifactsWorker
  include Sidekiq::Worker
3
  include DedicatedSidekiqQueue
4 5

  def perform(build_id)
6 7 8 9
    build = Ci::Build
      .with_expired_artifacts
      .reorder(nil)
      .find_by(id: build_id)
10

11
    return unless build&.project && !build.project.pending_delete
12 13

    Rails.logger.info "Removing artifacts for build #{build.id}..."
14 15 16
    build.erase_artifacts!
  end
end