Class: Gitlab::Ci::Pipeline::Seed::Stage
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/pipeline/seed/stage.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #errors ⇒ Object
- #included? ⇒ Boolean
-
#initialize(context, attributes, previous_stages) ⇒ Stage
constructor
A new instance of Stage.
- #seeds ⇒ Object
- #seeds_names ⇒ Object
- #to_resource ⇒ Object
Constructor Details
#initialize(context, attributes, previous_stages) ⇒ Stage
Returns a new instance of Stage.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 13 def initialize(context, attributes, previous_stages) @context = context @pipeline = context.pipeline @attributes = attributes @previous_stages = previous_stages @builds = attributes.fetch(:builds).map do |attributes| Seed::Build.new(context, attributes, previous_stages + [self]) end end |
Instance Method Details
#attributes ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 24 def attributes { name: @attributes.fetch(:name), position: @attributes.fetch(:index), pipeline: @pipeline, project: @pipeline.project, partition_id: @pipeline.partition_id } end |
#errors ⇒ Object
37 38 39 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 37 def errors @builds.flat_map(&:errors).compact end |
#included? ⇒ Boolean
47 48 49 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 47 def included? seeds.any? end |
#seeds ⇒ Object
32 33 34 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 32 def seeds @builds.select(&:included?) end |
#seeds_names ⇒ Object
42 43 44 |
# File 'lib/gitlab/ci/pipeline/seed/stage.rb', line 42 def seeds_names seeds.map(&:name).to_set end |