Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_runner_service.rb « runners « ci « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bd01f52f396aa507fd8f05eba7b3441210b09a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Ci
  module Runners
    class UpdateRunnerService
      attr_reader :runner

      def initialize(runner)
        @runner = runner
      end

      def execute(params)
        params[:active] = !params.delete(:paused) if params.include?(:paused)

        if runner.update(params)
          runner.tick_runner_queue
          ServiceResponse.success
        else
          ServiceResponse.error(message: runner.errors.full_messages)
        end
      end
    end
  end
end