debian-mirror-gitlab/app/graphql/resolvers/concerns/resolves_pipelines.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.7 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module ResolvesPipelines
extend ActiveSupport::Concern
included do
2021-01-29 00:20:46 +05:30
type Types::Ci::PipelineType.connection_type, null: false
2018-11-08 19:23:39 +05:30
argument :status,
Types::Ci::PipelineStatusEnum,
required: false,
2021-03-08 18:12:59 +05:30
description: "Filter pipelines by their status."
2021-12-11 22:18:48 +05:30
argument :scope, ::Types::Ci::PipelineScopeEnum,
required: false,
description: 'Filter pipelines by scope.'
2018-11-08 19:23:39 +05:30
argument :ref,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2018-11-08 19:23:39 +05:30
required: false,
2021-03-08 18:12:59 +05:30
description: "Filter pipelines by the ref they are run for."
2018-11-08 19:23:39 +05:30
argument :sha,
2021-10-27 15:23:28 +05:30
GraphQL::Types::String,
2018-11-08 19:23:39 +05:30
required: false,
2021-03-08 18:12:59 +05:30
description: "Filter pipelines by the sha of the commit they are run for."
2021-11-11 11:23:49 +05:30
argument :source,
GraphQL::Types::String,
required: false,
2022-03-02 08:16:31 +05:30
description: "Filter pipelines by their source."
2022-05-07 20:08:51 +05:30
argument :updated_after, Types::TimeType,
required: false,
description: 'Pipelines updated after this date.'
argument :updated_before, Types::TimeType,
required: false,
description: 'Pipelines updated before this date.'
argument :username,
GraphQL::Types::String,
required: false,
description: "Filter pipelines by the user that triggered the pipeline."
2018-11-08 19:23:39 +05:30
end
2019-07-31 22:56:46 +05:30
class_methods do
2019-09-04 21:01:54 +05:30
def resolver_complexity(args, child_complexity:)
2019-07-31 22:56:46 +05:30
complexity = super
complexity += 2 if args[:sha]
complexity += 2 if args[:ref]
complexity
end
end
2018-11-08 19:23:39 +05:30
def resolve_pipelines(project, params = {})
2020-04-08 14:13:33 +05:30
Ci::PipelinesFinder.new(project, context[:current_user], params).execute
2018-11-08 19:23:39 +05:30
end
end