2022-05-07 20:08:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
module Runners
|
|
|
|
class UpdateRunnerService
|
|
|
|
attr_reader :runner
|
|
|
|
|
|
|
|
def initialize(runner)
|
|
|
|
@runner = runner
|
|
|
|
end
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
def execute(params)
|
2022-05-07 20:08:51 +05:30
|
|
|
params[:active] = !params.delete(:paused) if params.include?(:paused)
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
if runner.update(params)
|
|
|
|
runner.tick_runner_queue
|
|
|
|
ServiceResponse.success
|
|
|
|
else
|
|
|
|
ServiceResponse.error(message: runner.errors.full_messages)
|
2022-05-07 20:08:51 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|