From 36a59d088eca61b834191dacea009677a96c052f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 May 2022 07:33:21 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-0-stable-ee --- app/graphql/resolvers/ci/config_resolver.rb | 30 ++++++++++------------ app/graphql/resolvers/ci/runner_status_resolver.rb | 9 +++++-- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'app/graphql/resolvers/ci') diff --git a/app/graphql/resolvers/ci/config_resolver.rb b/app/graphql/resolvers/ci/config_resolver.rb index f9d60650443..6f861012d83 100644 --- a/app/graphql/resolvers/ci/config_resolver.rb +++ b/app/graphql/resolvers/ci/config_resolver.rb @@ -37,7 +37,7 @@ module Resolvers .new(project: project, current_user: context[:current_user], sha: sha) .validate(content, dry_run: dry_run) - response(result).merge(merged_yaml: result.merged_yaml) + response(result) rescue GRPC::InvalidArgument => error Gitlab::ErrorTracking.track_and_raise_exception(error, sha: sha) end @@ -45,20 +45,14 @@ module Resolvers private def response(result) - if result.errors.empty? - { - status: :valid, - errors: [], - warnings: result.warnings, - stages: make_stages(result.jobs) - } - else - { - status: :invalid, - warnings: result.warnings, - errors: result.errors - } - end + { + status: result.status, + errors: result.errors, + warnings: result.warnings, + stages: make_stages(result), + merged_yaml: result.merged_yaml, + includes: result.includes + } end def make_jobs(config_jobs) @@ -90,8 +84,10 @@ module Resolvers end end - def make_stages(jobs) - make_groups(jobs) + def make_stages(result) + return [] unless result.valid? + + make_groups(result.jobs) .group_by { |group| group[:stage] } .map { |name, groups| { name: name, groups: groups } } end diff --git a/app/graphql/resolvers/ci/runner_status_resolver.rb b/app/graphql/resolvers/ci/runner_status_resolver.rb index d916a8a13f0..447ab306ba7 100644 --- a/app/graphql/resolvers/ci/runner_status_resolver.rb +++ b/app/graphql/resolvers/ci/runner_status_resolver.rb @@ -3,7 +3,8 @@ 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 15.0 once the API has stabilized. + # 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 @@ -14,7 +15,11 @@ module Resolvers default_value: '14.5', required: false, description: 'Compatibility mode. A null value turns off compatibility mode.', - deprecated: { reason: 'Will be removed in 15.0. From that release onward, the field will behave as if legacyMode is null', milestone: '14.6' } + 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) -- cgit v1.2.1