Class: Resolvers::Ci::RunnerSetupResolver

Inherits:
BaseResolver
  • Object
show all
Defined in:
app/graphql/resolvers/ci/runner_setup_resolver.rb

Constant Summary collapse

ACCESS_DENIED =
'User is not authorized to register a runner for the specified resource!'

Instance Method Summary collapse

Methods inherited from BaseResolver

as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calculate_ext_conn_complexity, calls_gitaly!, complexity, complexity_multiplier, #current_user, field_options, last, #object, #offset_pagination, requires_argument!, resolver_complexity, #select_result, single, #single?, single_definition_blocks, singular_type, when_single

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Instance Method Details

#resolve(platform:, architecture:, **args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/graphql/resolvers/ci/runner_setup_resolver.rb', line 33

def resolve(platform:, architecture:, **args)
  instructions = Gitlab::Ci::RunnerInstructions.new(
    os: platform,
    arch: architecture
  )

  {
    install_instructions: instructions.install_script || other_install_instructions(platform),
    register_instructions: instructions.register_command
  }
ensure
  raise Gitlab::Graphql::Errors::ResourceNotAvailable, ACCESS_DENIED if access_denied?(instructions)
end