2021-04-02 11:09:19 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class AfterRequeueJobService < ::BaseService
|
|
|
|
def execute(processable)
|
|
|
|
process_subsequent_jobs(processable)
|
2021-04-30 14:10:09 -04:00
|
|
|
reset_source_bridge(processable)
|
2021-04-02 11:09:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def process_subsequent_jobs(processable)
|
|
|
|
processable.pipeline.processables.skipped.after_stage(processable.stage_idx).find_each do |processable|
|
|
|
|
process(processable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
def reset_source_bridge(processable)
|
|
|
|
processable.pipeline.reset_source_bridge!(current_user)
|
2021-04-02 11:09:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def process(processable)
|
|
|
|
Gitlab::OptimisticLocking.retry_lock(processable, name: 'ci_requeue_job') do |processable|
|
|
|
|
processable.process(current_user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|