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, runner: nil, params: {}, type: ::Ci::Build) ⇒ JobsFinder

Returns a new instance of JobsFinder.



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

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

Instance Method Details

#executeObject



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

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