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

  def perform(build_id)
Douwe Maan's avatar
Douwe Maan committed
6 7 8 9
    build = Ci::Build.
      with_expired_artifacts.
      reorder(nil).
      find_by(id: build_id)
10

11 12 13
    return unless build.try(:project)

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