diff options
Diffstat (limited to 'app/graphql/types/ci')
-rw-r--r-- | app/graphql/types/ci/job_kind_enum.rb | 12 | ||||
-rw-r--r-- | app/graphql/types/ci/job_type.rb | 8 | ||||
-rw-r--r-- | app/graphql/types/ci/runner_upgrade_status_type_enum.rb | 21 |
3 files changed, 41 insertions, 0 deletions
diff --git a/app/graphql/types/ci/job_kind_enum.rb b/app/graphql/types/ci/job_kind_enum.rb new file mode 100644 index 00000000000..dd1d80f806c --- /dev/null +++ b/app/graphql/types/ci/job_kind_enum.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Types + module Ci + class JobKindEnum < BaseEnum + graphql_name 'CiJobKind' + + value 'BUILD', value: ::Ci::Build, description: 'Standard CI job.' + value 'BRIDGE', value: ::Ci::Bridge, description: 'Bridge CI job connecting a parent and child pipeline.' + end + end +end diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 83054553bd8..f25fc56a588 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -17,6 +17,8 @@ module Types description: 'Duration of the job in seconds.' field :id, ::Types::GlobalIDType[::CommitStatus].as('JobID'), null: true, description: 'ID of the job.' + field :kind, type: ::Types::Ci::JobKindEnum, null: false, + description: 'Indicates the type of job.' field :name, GraphQL::Types::String, null: true, description: 'Name of the job.' field :needs, BuildNeedType.connection_type, null: true, @@ -87,6 +89,12 @@ module Types field :triggered, GraphQL::Types::Boolean, null: true, description: 'Whether the job was triggered.' + def kind + return ::Ci::Build unless [::Ci::Build, ::Ci::Bridge].include?(object.class) + + object.class + end + def pipeline Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, object.pipeline_id).find end diff --git a/app/graphql/types/ci/runner_upgrade_status_type_enum.rb b/app/graphql/types/ci/runner_upgrade_status_type_enum.rb new file mode 100644 index 00000000000..e3d77e485bc --- /dev/null +++ b/app/graphql/types/ci/runner_upgrade_status_type_enum.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Types + module Ci + class RunnerUpgradeStatusTypeEnum < BaseEnum + graphql_name 'CiRunnerUpgradeStatusType' + + value 'NOT_AVAILABLE', + description: "An update is not available for the runner.", + value: :not_available + + value 'AVAILABLE', + description: "An update is available for the runner.", + value: :available + + value 'RECOMMENDED', + description: "An update is available and recommended for the runner.", + value: :recommended + end + end +end |