summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/ci/runner_status_resolver.rb
blob: 447ab306ba7c6f399b3da8b40ca3d618c10fbcea (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
25
26
27
28
29
# frozen_string_literal: true

module Resolvers
  module Ci
    # NOTE: This class was introduced to allow modifying the meaning of certain values in RunnerStatusEnum
    # while preserving backward compatibility. It can be removed in 17.0 after being deprecated
    # and made a no-op in %16.0 (legacy_mode will be hard-coded to nil).
    class RunnerStatusResolver < BaseResolver
      type Types::Ci::RunnerStatusEnum, null: false

      alias_method :runner, :object

      argument :legacy_mode,
               type: GraphQL::Types::String,
               default_value: '14.5',
               required: false,
               description: 'Compatibility mode. A null value turns off compatibility mode.',
               deprecated: {
                 reason: 'Will be removed in 17.0. In GitLab 16.0 and later, ' \
                         'the field will act as if `legacyMode` is null',
                 milestone: '15.0'
               }

      def resolve(legacy_mode:, **args)
        runner.status(legacy_mode)
      end
    end
  end
end