2020-10-13 05:08:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PlayBridgeService < ::BaseService
|
|
|
|
def execute(bridge)
|
2021-05-20 02:10:43 -04:00
|
|
|
check_access!(bridge)
|
2020-10-13 05:08:27 -04:00
|
|
|
|
|
|
|
bridge.tap do |bridge|
|
|
|
|
bridge.user = current_user
|
|
|
|
bridge.enqueue!
|
2021-04-02 11:09:19 -04:00
|
|
|
|
|
|
|
AfterRequeueJobService.new(project, current_user).execute(bridge)
|
2020-10-13 05:08:27 -04:00
|
|
|
end
|
|
|
|
end
|
2021-05-20 02:10:43 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def check_access!(bridge)
|
|
|
|
raise Gitlab::Access::AccessDeniedError unless can?(current_user, :play_job, bridge)
|
|
|
|
end
|
2020-10-13 05:08:27 -04:00
|
|
|
end
|
|
|
|
end
|
2021-05-20 02:10:43 -04:00
|
|
|
|
|
|
|
Ci::PlayBridgeService.prepend_mod_with('Ci::PlayBridgeService')
|