Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci')
-rw-r--r--app/graphql/types/ci/group_type.rb17
-rw-r--r--app/graphql/types/ci/job_type.rb15
-rw-r--r--app/graphql/types/ci/pipeline_config_source_enum.rb11
-rw-r--r--app/graphql/types/ci/pipeline_type.rb13
-rw-r--r--app/graphql/types/ci/stage_type.rb15
5 files changed, 69 insertions, 2 deletions
diff --git a/app/graphql/types/ci/group_type.rb b/app/graphql/types/ci/group_type.rb
new file mode 100644
index 00000000000..04c0eb93068
--- /dev/null
+++ b/app/graphql/types/ci/group_type.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class GroupType < BaseObject
+ graphql_name 'CiGroup'
+
+ field :name, GraphQL::STRING_TYPE, null: true,
+ description: 'Name of the job group'
+ field :size, GraphQL::INT_TYPE, null: true,
+ description: 'Size of the group'
+ field :jobs, Ci::JobType.connection_type, null: true,
+ description: 'Jobs in group'
+ end
+ end
+end
diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb
new file mode 100644
index 00000000000..4c18f3ffd52
--- /dev/null
+++ b/app/graphql/types/ci/job_type.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class JobType < BaseObject
+ graphql_name 'CiJob'
+
+ field :name, GraphQL::STRING_TYPE, null: true,
+ description: 'Name of the job'
+ field :needs, JobType.connection_type, null: true,
+ description: 'Builds that must complete before the jobs run'
+ end
+ end
+end
diff --git a/app/graphql/types/ci/pipeline_config_source_enum.rb b/app/graphql/types/ci/pipeline_config_source_enum.rb
new file mode 100644
index 00000000000..48f88c133b4
--- /dev/null
+++ b/app/graphql/types/ci/pipeline_config_source_enum.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ class PipelineConfigSourceEnum < BaseEnum
+ ::Ci::PipelineEnums.config_sources.keys.each do |state_symbol|
+ value state_symbol.to_s.upcase, value: state_symbol.to_s
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb
index 32050766e5b..82a9f8495ce 100644
--- a/app/graphql/types/ci/pipeline_type.rb
+++ b/app/graphql/types/ci/pipeline_type.rb
@@ -5,6 +5,8 @@ module Types
class PipelineType < BaseObject
graphql_name 'Pipeline'
+ connection_type_class(Types::CountableConnectionType)
+
authorize :read_pipeline
expose_permissions Types::PermissionTypes::Ci::Pipeline
@@ -23,6 +25,8 @@ module Types
field :detailed_status, Types::Ci::DetailedStatusType, null: false,
description: 'Detailed status of the pipeline',
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }
+ field :config_source, PipelineConfigSourceEnum, null: true,
+ description: "Config source of the pipeline (#{::Ci::PipelineEnums.config_sources.keys.join(', ').upcase})"
field :duration, GraphQL::INT_TYPE, null: true,
description: 'Duration of the pipeline in seconds'
field :coverage, GraphQL::FLOAT_TYPE, null: true,
@@ -37,8 +41,13 @@ module Types
description: "Timestamp of the pipeline's completion"
field :committed_at, Types::TimeType, null: true,
description: "Timestamp of the pipeline's commit"
-
- # TODO: Add triggering user as a type
+ field :stages, Types::Ci::StageType.connection_type, null: true,
+ description: 'Stages of the pipeline',
+ extras: [:lookahead],
+ resolver: Resolvers::Ci::PipelineStagesResolver
+ field :user, Types::UserType, null: true,
+ description: 'Pipeline user',
+ resolve: -> (pipeline, _args, _context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, pipeline.user_id).find }
end
end
end
diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb
new file mode 100644
index 00000000000..278c4d4d748
--- /dev/null
+++ b/app/graphql/types/ci/stage_type.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Types
+ module Ci
+ # rubocop: disable Graphql/AuthorizeTypes
+ class StageType < BaseObject
+ graphql_name 'CiStage'
+
+ field :name, GraphQL::STRING_TYPE, null: true,
+ description: 'Name of the stage'
+ field :groups, Ci::GroupType.connection_type, null: true,
+ description: 'Group of jobs for the stage'
+ end
+ end
+end