Sha256: fb35c4bf5d96c8abee1dee0568bbf65970717986c62bb9a7e6cb133e7e5a160e

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

module Vx
  module Builder
    class ScriptBuilder

      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
          env.source.env.matrix.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

9 entries across 9 versions & 1 rubygems

Version Path
vx-builder-0.3.8 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.7 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.6 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.5 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.4 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.3 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.2 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.1 lib/vx/builder/script_builder/env.rb
vx-builder-0.3.0 lib/vx/builder/script_builder/env.rb