Sha256: bb93935770237a8b34d159545a129a1afe601f4fdbd8b5e56dd1ed9c7712109b

Contents?: true

Size: 824 Bytes

Versions: 121

Compression:

Stored size: 824 Bytes

Contents

module KnapsackPro
  module Config
    module CI
      class SnapCI < Base
        def node_total
          ENV['SNAP_WORKER_TOTAL']
        end

        def node_index
          index = ENV['SNAP_WORKER_INDEX']
          index.to_i - 1 if index
        end

        def node_build_id
          ENV['SNAP_PIPELINE_COUNTER']
        end

        def commit_hash
          ENV['SNAP_COMMIT']
        end

        # https://docs.snap-ci.com/environment-variables/
        # SNAP_BRANCH - the name of the git branch (not present on pull requests)
        # SNAP_UPSTREAM_BRANCH - the upstream branch for which the pull request was opened
        def branch
          ENV['SNAP_BRANCH'] || ENV['SNAP_UPSTREAM_BRANCH']
        end

        def project_dir
          ENV['SNAP_WORKING_DIR']
        end
      end
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
knapsack_pro-0.18.0 lib/knapsack_pro/config/ci/snap_ci.rb