Sha256: 1caba77107eaa59a0e898c0447e1ca36f17b2723f7fa46f3bf39356a2c827247

Contents?: true

Size: 892 Bytes

Versions: 13

Compression:

Stored size: 892 Bytes

Contents

# https://docs.gitlab.com/ce/ci/variables/
module KnapsackPro
  module Config
    module CI
      class GitlabCI < Base
        def node_total
          ENV['CI_NODE_TOTAL']
        end

        def node_index
          return unless ENV['GITLAB_CI']
          # GitLab 11.5
          index = ENV['CI_NODE_INDEX']
          index.to_i - 1 if index
        end

        def node_build_id
          ENV['CI_JOB_ID'] || # Gitlab Release 9.0+
          ENV['CI_BUILD_ID']  # Gitlab Release 8.x
        end

        def commit_hash
          ENV['CI_COMMIT_SHA'] || # Gitlab Release 9.0+
          ENV['CI_BUILD_REF'] # Gitlab Release 8.x
        end

        def branch
          ENV['CI_COMMIT_REF_NAME'] || # Gitlab Release 9.0+
          ENV['CI_BUILD_REF_NAME'] # Gitlab Release 8.x
        end

        def project_dir
          ENV['CI_PROJECT_DIR']
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
knapsack_pro-1.12.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.11.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.10.1 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.10.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.9.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.8.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.7.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.6.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.5.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.4.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.3.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.2.1 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-1.2.0 lib/knapsack_pro/config/ci/gitlab_ci.rb