diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/graphql/types/ci | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/graphql/types/ci')
-rw-r--r-- | app/graphql/types/ci/detailed_status_type.rb | 2 | ||||
-rw-r--r-- | app/graphql/types/ci/job_type.rb | 3 | ||||
-rw-r--r-- | app/graphql/types/ci/pipeline_type.rb | 40 | ||||
-rw-r--r-- | app/graphql/types/ci/runner_setup_type.rb | 15 |
4 files changed, 59 insertions, 1 deletions
diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index f4a50115ee6..6d8af400ac4 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -30,7 +30,7 @@ module Types if obj.has_action? { button_title: obj.action_button_title, - icon: obj.icon, + icon: obj.action_icon, method: obj.action_method, path: obj.action_path, title: obj.action_title diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 0ee1ad47b62..feaff4e81d8 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -6,6 +6,9 @@ module Types class JobType < BaseObject graphql_name 'CiJob' + field :pipeline, Types::Ci::PipelineType, null: false, + description: 'Pipeline the job belongs to', + resolve: -> (build, _, _) { Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, build.pipeline_id).find } field :name, GraphQL::STRING_TYPE, null: true, description: 'Name of the job' field :needs, JobType.connection_type, null: true, diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index c508b746317..c25db39f600 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -13,49 +13,89 @@ module Types field :id, GraphQL::ID_TYPE, null: false, description: 'ID of the pipeline' + field :iid, GraphQL::STRING_TYPE, null: false, description: 'Internal ID of the pipeline' field :sha, GraphQL::STRING_TYPE, null: false, description: "SHA of the pipeline's commit" + field :before_sha, GraphQL::STRING_TYPE, null: true, description: 'Base SHA of the source branch' + field :status, PipelineStatusEnum, null: false, description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" + 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 (#{::Enums::Ci::Pipeline.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, description: 'Coverage percentage' + field :created_at, Types::TimeType, null: false, description: "Timestamp of the pipeline's creation" + field :updated_at, Types::TimeType, null: false, description: "Timestamp of the pipeline's last activity" + field :started_at, Types::TimeType, null: true, description: 'Timestamp when the pipeline was started' + field :finished_at, Types::TimeType, null: true, description: "Timestamp of the pipeline's completion" + field :committed_at, Types::TimeType, null: true, description: "Timestamp of the pipeline's commit" + 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 } + field :retryable, GraphQL::BOOLEAN_TYPE, description: 'Specifies if a pipeline can be retried', method: :retryable?, null: false + field :cancelable, GraphQL::BOOLEAN_TYPE, description: 'Specifies if a pipeline can be canceled', method: :cancelable?, null: false + + field :jobs, + ::Types::Ci::JobType.connection_type, + null: true, + description: 'Jobs belonging to the pipeline', + resolver: ::Resolvers::Ci::JobsResolver + + field :source_job, Types::Ci::JobType, null: true, + description: 'Job where pipeline was triggered from' + + field :downstream, Types::Ci::PipelineType.connection_type, null: true, + description: 'Pipelines this pipeline will trigger', + method: :triggered_pipelines_with_preloads + + field :upstream, Types::Ci::PipelineType, null: true, + description: 'Pipeline that triggered the pipeline', + method: :triggered_by_pipeline + + field :path, GraphQL::STRING_TYPE, null: true, + description: "Relative path to the pipeline's page", + resolve: -> (obj, _args, _ctx) { ::Gitlab::Routing.url_helpers.project_pipeline_path(obj.project, obj) } + + field :project, Types::ProjectType, null: true, + description: 'Project the pipeline belongs to' end end end diff --git a/app/graphql/types/ci/runner_setup_type.rb b/app/graphql/types/ci/runner_setup_type.rb new file mode 100644 index 00000000000..66abcf65adf --- /dev/null +++ b/app/graphql/types/ci/runner_setup_type.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + class RunnerSetupType < BaseObject + graphql_name 'RunnerSetup' + + field :install_instructions, GraphQL::STRING_TYPE, null: false, + description: 'Instructions for installing the runner on the specified architecture' + field :register_instructions, GraphQL::STRING_TYPE, null: true, + description: 'Instructions for registering the runner' + end + end +end |