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

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

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from Helpers

#error, #persist_pipeline?, #warning

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Ci::Pipeline::Chain::Base

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)

37
38
39
# File 'lib/gitlab/ci/pipeline/chain/seed.rb', line 37

def break?
  pipeline.errors.any?
end

#perform!Object

Raises:

  • (ArgumentError)

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gitlab/ci/pipeline/chain/seed.rb', line 11

def perform!
  raise ArgumentError, 'missing YAML processor result' unless @command.yaml_processor_result

  # Allocate next IID. This operation must be outside of transactions of pipeline creations.
  pipeline.ensure_project_iid!
  pipeline.ensure_ci_ref!

  # Protect the pipeline. This is assigned in Populate instead of
  # Build to prevent erroring out on ambiguous refs.
  pipeline.protected = @command.protected_ref?

  ##
  # Populate pipeline with block argument of CreatePipelineService#execute.
  #
  @command.seeds_block&.call(pipeline)

  ##
  # Gather all runtime build/stage errors
  #
  if stage_seeds_errors
    return error(stage_seeds_errors.join("\n"), config_error: true)
  end

  @command.stage_seeds = stage_seeds
end