Class: Gitlab::Ci::Pipeline::Chain::Populate

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/gitlab/ci/pipeline/chain/populate.rb

Constant Summary collapse

PopulateError =
Class.new(StandardError)

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)


32
33
34
# File 'lib/gitlab/ci/pipeline/chain/populate.rb', line 32

def break?
  pipeline.errors.any?
end

#perform!Object

Raises:

  • (ArgumentError)


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

def perform!
  raise ArgumentError, 'missing pipeline seed' unless @command.pipeline_seed

  ##
  # Populate pipeline with all stages, and stages with builds.
  #
  pipeline.stages = @command.pipeline_seed.stages

  if stage_names.empty?
    return error('Pipeline will not run for the selected trigger. ' \
      'The rules configuration prevented any jobs from being added to the pipeline.')
  end

  if pipeline.invalid?
    return error('Failed to build the pipeline!')
  end

  raise Populate::PopulateError if pipeline.persisted?
end