Class: Ci::JobsFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Allowable
Defined in:
app/finders/ci/jobs_finder.rb

Instance Method Summary collapse

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(current_user:, pipeline: nil, project: nil, params: {}, type: ::Ci::Build) ⇒ JobsFinder

Returns a new instance of JobsFinder.


7
8
9
10
11
12
13
14
# File 'app/finders/ci/jobs_finder.rb', line 7

def initialize(current_user:, pipeline: nil, project: nil, params: {}, type: ::Ci::Build)
  @pipeline = pipeline
  @current_user = current_user
  @project = project
  @params = params
  @type = type
  raise ArgumentError 'type must be a subclass of Ci::Processable' unless type < ::Ci::Processable
end

Instance Method Details

#executeObject


16
17
18
19
20
21
# File 'app/finders/ci/jobs_finder.rb', line 16

def execute
  builds = init_collection.order_id_desc
  filter_by_scope(builds)
rescue Gitlab::Access::AccessDeniedError
  type.none
end