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 Helpers

#error, #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)


39
40
41
# File 'lib/gitlab/ci/pipeline/chain/seed.rb', line 39

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
36
37
# File 'lib/gitlab/ci/pipeline/chain/seed.rb', line 11

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

  # Allocate next IID. This operation must be outside of transactions of pipeline creations.
  logger.instrument(:pipeline_allocate_seed_attributes, once: true) do
    pipeline.ensure_project_iid!
    pipeline.ensure_ci_ref!
  end

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

  ##
  # Gather all runtime build/stage errors
  #
  seed_errors = logger.instrument(:pipeline_seed_evaluation, once: true) do
    pipeline_seed.errors
  end

  if seed_errors
    return error(seed_errors.join("\n"), config_error: true)
  end

  @command.pipeline_seed = pipeline_seed
end