Sha256: ca91a9926ee394478c1fbe04f7fae8a467824901efd4e1e3c44fc84d9dd99fb3

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

require 'contracts'

module Fuselage
  module Support
    module BuildMetadata
      include ::Contracts::Core
      include ::Contracts::Builtin

      Contract None => String
      def build_id
        ENV.fetch 'BUILD_ID'
      rescue KeyError
        STDERR.puts 'Environment is missing BUILD_ID'
        abort
      end

      Contract None => String
      def build_name
        ENV.fetch 'BUILD_NAME'
      rescue KeyError
        STDERR.puts 'Environment is missing BUILD_NAME'
        abort
      end

      Contract None => String
      def build_job_name
        ENV.fetch 'BUILD_JOB_NAME'
      rescue KeyError
        STDERR.puts 'Environment is missing BUILD_JOB_NAME'
        abort
      end

      Contract None => String
      def build_pipeline_name
        ENV.fetch 'BUILD_PIPELINE_NAME'
      rescue KeyError
        STDERR.puts 'Environment is missing BUILD_PIPELINE_NAME'
        abort
      end

      Contract None => String
      def atc_external_url
        ENV.fetch 'ATC_EXTERNAL_URL'
      rescue KeyError
        STDERR.puts 'Environment is missing ATC_EXTERNAL_URL'
        abort
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
concourse-fuselage-0.5.8 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.5.7 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.5.2 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.5.1 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.5.0 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.4.1 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.4.0 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.3.2 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.3.1 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.3.0 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.2.0 lib/concourse-fuselage/support/build_metadata.rb
concourse-fuselage-0.1.1 lib/concourse-fuselage/support/build_metadata.rb