2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class PlayBridgeService < ::BaseService
|
|
|
|
def execute(bridge)
|
2021-09-04 01:27:46 +05:30
|
|
|
check_access!(bridge)
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
bridge.tap do |bridge|
|
|
|
|
bridge.user = current_user
|
|
|
|
bridge.enqueue!
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
AfterRequeueJobService.new(project, current_user).execute(bridge)
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def check_access!(bridge)
|
|
|
|
raise Gitlab::Access::AccessDeniedError unless can?(current_user, :play_job, bridge)
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
Ci::PlayBridgeService.prepend_mod_with('Ci::PlayBridgeService')
|