From 9dc93a4519d9d5d7be48ff274127136236a3adb3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 20 Apr 2021 23:50:22 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-11-stable-ee --- app/graphql/types/ci/pipeline_type.rb | 45 ++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'app/graphql/types/ci/pipeline_type.rb') diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 49be200a788..2e83f6c1f5a 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -81,6 +81,20 @@ module Types description: 'Jobs belonging to the pipeline.', resolver: ::Resolvers::Ci::JobsResolver + field :job, + type: ::Types::Ci::JobType, + null: true, + description: 'A specific job in this pipeline, either by name or ID.' do + argument :id, + type: ::Types::GlobalIDType[::CommitStatus], + required: false, + description: 'ID of the job.' + argument :name, + type: ::GraphQL::STRING_TYPE, + required: false, + description: 'Name of the job.' + end + field :source_job, Types::Ci::JobType, null: true, description: 'Job where pipeline was triggered from.' @@ -104,8 +118,24 @@ module Types field :active, GraphQL::BOOLEAN_TYPE, null: false, method: :active?, description: 'Indicates if the pipeline is active.' + field :uses_needs, GraphQL::BOOLEAN_TYPE, null: true, + method: :uses_needs?, + description: 'Indicates if the pipeline has jobs with `needs` dependencies.' + + field :test_report_summary, + Types::Ci::TestReportSummaryType, + null: false, + description: 'Summary of the test report generated by the pipeline.', + resolver: Resolvers::Ci::TestReportSummaryResolver + + field :test_suite, + Types::Ci::TestSuiteType, + null: true, + description: 'A specific test suite in a pipeline test report.', + resolver: Resolvers::Ci::TestSuiteResolver + def detailed_status - object.detailed_status(context[:current_user]) + object.detailed_status(current_user) end def user @@ -119,6 +149,19 @@ module Types def path ::Gitlab::Routing.url_helpers.project_pipeline_path(object.project, object) end + + def job(id: nil, name: nil) + raise ::Gitlab::Graphql::Errors::ArgumentError, 'One of id or name is required' unless id || name + + if id + id = ::Types::GlobalIDType[::CommitStatus].coerce_isolated_input(id) if id + pipeline.statuses.id_in(id.model_id) + else + pipeline.statuses.by_name(name) + end.take # rubocop: disable CodeReuse/ActiveRecord + end + + alias_method :pipeline, :object end end end -- cgit v1.2.1