Sha256: 41909e74ff9c66748ee12e5008055fb0a0ca1b946184a5f2601d45ab376161ac

Contents?: true

Size: 909 Bytes

Versions: 7

Compression:

Stored size: 909 Bytes

Contents

module Vx
  module Builder
    class Script

      class Env < Base

        def call(env)
          env.init << "set -e"
          env.init << "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
          env.init << 'export LC_ALL=en_US.UTF8'
          env.init << 'export DEBIAN_FRONTEND=noninteractive'

          export_vars(env, env.init)
          export_vars(env, env.after_script_init)

          env.source.env.global.each do |e|
            env.init << trace_sh_command("export #{e}")
          end
          app.call(env)
        end

        private

          def export_vars(env, collection)
            collection << "export CI_JOB_ID=#{env.task.job_id}"
            collection << "export CI_BUILD_ID=#{env.task.build_id}"

            if b = env.task.branch
              collection << "export CI_BRANCH=#{b}"
            end
          end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vx-builder-0.3.3 lib/vx/builder/script_builder/env.rb-e
vx-builder-0.3.2 lib/vx/builder/script_builder/env.rb-e
vx-builder-0.3.1 lib/vx/builder/script_builder/env.rb-e
vx-builder-0.3.0 lib/vx/builder/script_builder/env.rb-e
vx-builder-0.2.2 lib/vx/builder/script/env.rb
vx-builder-0.2.1 lib/vx/builder/script/env.rb
vx-builder-0.2.0 lib/vx/builder/script/env.rb