Sha256: e7619286dbba0e6eb20cd25d3b81fd89e51ec4d1a73c99ac2bcd98008370f6e2

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Buildkite
  module Builder
    module Commands
      class Run < Abstract
        private
        include LoggingUtils
        using Rainbow

        self.description = 'Builds and uploads the generated pipeline.'

        def run
          relative_pipeline_path = pipeline_path.relative_path_from(Builder.root)

          # This entrypoint is for running on CI. It expects certain environment
          # variables to be set. It also uploads the pipeline to Buildkite.
          log.info "#{'+++ ' if Buildkite.env}🧰 " + 'Buildkite Builder'.color(:springgreen) + " ─ #{relative_pipeline_path.to_s.yellow}"
          Context.new(pipeline_path, logger: log).upload
        end

        private

        def pipeline_path
          pipeline_path_override || super
        end

        def pipeline_path_override
          if ENV['BUILDKITE_BUILDER_PIPELINE_PATH']
            path = Pathname.new(ENV['BUILDKITE_BUILDER_PIPELINE_PATH'])
            path.absolute? ? path : Builder.root.join(path)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
buildkite-builder-1.4.1 lib/buildkite/builder/commands/run.rb
buildkite-builder-1.4.0 lib/buildkite/builder/commands/run.rb
buildkite-builder-1.3.1 lib/buildkite/builder/commands/run.rb
buildkite-builder-1.3.0 lib/buildkite/builder/commands/run.rb