Class: Resolvers::Ci::ProjectPipelineResolver
- Inherits:
-
BaseResolver
- Object
- GraphQL::Schema::Resolver
- BaseResolver
- Resolvers::Ci::ProjectPipelineResolver
- Includes:
- LooksAhead
- Defined in:
- app/graphql/resolvers/ci/project_pipeline_resolver.rb
Constant Summary
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Class Method Summary collapse
Instance Method Summary collapse
Methods included from LooksAhead
Methods inherited from BaseResolver
as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calculate_ext_conn_complexity, calls_gitaly!, calls_gitaly?, complexity, complexity_multiplier, #current_user, last, #object, #offset_pagination, requires_argument!, requires_argument?, #select_result, single, #single?, single_definition_blocks, singular_type, when_single
Methods included from Gitlab::Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Class Method Details
.resolver_complexity(args, child_complexity:) ⇒ Object
29 30 31 32 |
# File 'app/graphql/resolvers/ci/project_pipeline_resolver.rb', line 29 def self.resolver_complexity(args, child_complexity:) complexity = super complexity - 10 if args.present? end |
Instance Method Details
#resolve(id: nil, iid: nil, sha: nil, **args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/graphql/resolvers/ci/project_pipeline_resolver.rb', line 34 def resolve(id: nil, iid: nil, sha: nil, **args) self.lookahead = args.delete(:lookahead) if id BatchLoader::GraphQL.for(id).batch(key: project) do |ids, loader| finder = ::Ci::PipelinesFinder.new(project, current_user, ids: ids) apply_lookahead(finder.execute).each { |pipeline| loader.call(pipeline.id.to_s, pipeline) } end elsif iid BatchLoader::GraphQL.for(iid).batch(key: project) do |iids, loader| # This is a temporary workaround for some customers until # https://gitlab.com/gitlab-org/gitlab/-/issues/545167 is addressed args = { iids: iids } args[:sort] = :asc if Feature.enabled?(:single_pipeline_for_resolver, project) finder = ::Ci::PipelinesFinder.new(project, current_user, args) apply_lookahead(finder.execute).each { |pipeline| loader.call(pipeline.iid.to_s, pipeline) } end elsif sha BatchLoader::GraphQL.for(sha).batch(key: project) do |shas, loader| finder = ::Ci::PipelinesFinder.new(project, current_user, sha: shas) apply_lookahead(finder.execute).each { |pipeline| loader.call(pipeline.sha.to_s, pipeline) } end else project.last_pipeline end end |
#unconditional_includes ⇒ Object
65 66 67 68 69 |
# File 'app/graphql/resolvers/ci/project_pipeline_resolver.rb', line 65 def unconditional_includes [ { statuses: [:needs] } ] end |