diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/graphql/types/ci/pipeline_type.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/graphql/types/ci/pipeline_type.rb')
-rw-r--r-- | app/graphql/types/ci/pipeline_type.rb | 45 |
1 files changed, 44 insertions, 1 deletions
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 |