Sha256: af7a45ef15091f710b86e09533eb41d0fbe976c9eb04908116c651d671c049fb

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'contracts'

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

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

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

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

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

      Contract None => Maybe[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

1 entries across 1 versions & 1 rubygems

Version Path
concourse-fuselage-0.1.0 lib/concourse-fuselage/support/build_metadata.rb