Class: Gitlab::Ci::Pipeline::Chain::Config::Process

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

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

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)

41
42
43
# File 'lib/gitlab/ci/pipeline/chain/config/process.rb', line 41

def break?
  @pipeline.errors.any? || @pipeline.persisted?
end

#perform!Object


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
38
39
# File 'lib/gitlab/ci/pipeline/chain/config/process.rb', line 11

def perform!
  raise ArgumentError, 'missing config content' unless @command.config_content

  result = ::Gitlab::Ci::YamlProcessor.new(
    @command.config_content, {
      project: project,
      sha: @pipeline.sha,
      user: current_user,
      parent_pipeline: parent_pipeline
    }
  ).execute

  add_warnings_to_pipeline(result.warnings)

  if result.valid?
    @command.yaml_processor_result = result
  else
    error(result.errors.first, config_error: true)
  end

rescue => ex
  Gitlab::ErrorTracking.track_exception(ex,
    project_id: project.id,
    sha: @pipeline.sha
  )

  error("Undefined error (#{Labkit::Correlation::CorrelationId.current_id})",
    config_error: true)
end