module Buildkite::Pipelines::Helpers::SoftFail

Public Instance Methods

soft_fail(*value) click to toggle source
Calls superclass method
# File lib/buildkite/pipelines/helpers/soft_fail.rb, line 7
def soft_fail(*value)
  # soft_fail can be an array of exit_statuses or true
  # https://buildkite.com/docs/pipelines/command-step#soft-fail-attributes

  if value.first == true
    current = get('soft_fail')

    if current.is_a?(Array)
      raise ArgumentError, "Cannot set soft_fail to true when it's already an array.\nsoft_fail: #{current}"
    else
      set('soft_fail', true)
    end
  else
    super
  end
end
soft_fail_on_status(*statuses) click to toggle source
# File lib/buildkite/pipelines/helpers/soft_fail.rb, line 24
def soft_fail_on_status(*statuses)
  statuses.each do |status|
    soft_fail(exit_status: status)
  end
end