Sha256: 35a7e787db7fdafbe3999b8fd0349102497a2ad03488a2d623e024fcdf4ba3a0

Contents?: true

Size: 817 Bytes

Versions: 58

Compression:

Stored size: 817 Bytes

Contents

# frozen_string_literal: true

module Buildkite
  module Pipelines
    module Helpers
      module SoftFail
        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

        def soft_fail_on_status(*statuses)
          statuses.each do |status|
            soft_fail(exit_status: status)
          end
        end
      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
buildkite-builder-4.15.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.14.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.13.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.12.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.11.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.10.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.8.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.7.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.6.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.5.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.4.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.3.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.5 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.4 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.3 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.2 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.1 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.2.0 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.1.2 lib/buildkite/pipelines/helpers/soft_fail.rb
buildkite-builder-4.1.1 lib/buildkite/pipelines/helpers/soft_fail.rb