Class: Gitlab::Ci::Pipeline::Seed::Pipeline

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/pipeline/seed/pipeline.rb

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(context, stages_attributes) ⇒ Pipeline

Returns a new instance of Pipeline.


10
11
12
13
# File 'lib/gitlab/ci/pipeline/seed/pipeline.rb', line 10

def initialize(context, stages_attributes)
  @context = context
  @stages_attributes = stages_attributes
end

Instance Method Details

#deployments_countObject


27
28
29
30
31
32
33
# File 'lib/gitlab/ci/pipeline/seed/pipeline.rb', line 27

def deployments_count
  stage_seeds.sum do |stage_seed|
    stage_seed.seeds.count do |build_seed|
      build_seed.attributes[:environment].present?
    end
  end
end

#errorsObject


15
16
17
# File 'lib/gitlab/ci/pipeline/seed/pipeline.rb', line 15

def errors
  stage_seeds.flat_map(&:errors).compact.presence
end

#sizeObject


23
24
25
# File 'lib/gitlab/ci/pipeline/seed/pipeline.rb', line 23

def size
  stage_seeds.sum(&:size)
end

#stagesObject


19
20
21
# File 'lib/gitlab/ci/pipeline/seed/pipeline.rb', line 19

def stages
  stage_seeds.map(&:to_resource)
end