diff options
Diffstat (limited to 'app/graphql/resolvers/ci/runner_platforms_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/ci/runner_platforms_resolver.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/graphql/resolvers/ci/runner_platforms_resolver.rb b/app/graphql/resolvers/ci/runner_platforms_resolver.rb new file mode 100644 index 00000000000..9677c5139b4 --- /dev/null +++ b/app/graphql/resolvers/ci/runner_platforms_resolver.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Resolvers + module Ci + class RunnerPlatformsResolver < BaseResolver + type Types::Ci::RunnerPlatformType, null: false + + def resolve(**args) + runner_instructions.map do |platform, data| + { + name: platform, human_readable_name: data[:human_readable_name], + architectures: parse_architectures(data[:download_locations]) + } + end + end + + private + + def runner_instructions + Gitlab::Ci::RunnerInstructions::OS.merge(Gitlab::Ci::RunnerInstructions::OTHER_ENVIRONMENTS) + end + + def parse_architectures(download_locations) + download_locations&.map do |architecture, download_location| + { name: architecture, download_location: download_location } + end + end + end + end +end |