Module: Gitlab::Ci::Pipeline::Chain::Helpers

Instance Method Summary collapse

Instance Method Details

#error(message, config_error: false, drop_reason: nil) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gitlab/ci/pipeline/chain/helpers.rb', line 8

def error(message, config_error: false, drop_reason: nil)
  if config_error
    drop_reason = :config_error
    pipeline.yaml_errors = message
  end

  pipeline.add_error_message(message)
  pipeline.drop!(drop_reason) if drop_reason && persist_pipeline?

  # TODO: consider not to rely on AR errors directly as they can be
  # polluted with other unrelated errors (e.g. state machine)
  # https://gitlab.com/gitlab-org/gitlab/-/issues/220823
  pipeline.errors.add(:base, message)
end

#persist_pipeline?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/gitlab/ci/pipeline/chain/helpers.rb', line 27

def persist_pipeline?
  command.save_incompleted && !pipeline.readonly?
end

#warning(message) ⇒ Object


23
24
25
# File 'lib/gitlab/ci/pipeline/chain/helpers.rb', line 23

def warning(message)
  pipeline.add_warning_message(message)
end