Sha256: 9461f6c7251f78419a9e10cdf7b2cbc282cfd1e0a77cacdc06f37ab0286b3f70

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

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_PIPELINE_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

        def user_seat
          ENV['GITLAB_USER_NAME'] || # Gitlab Release 10.0
          ENV['GITLAB_USER_EMAIL'] # Gitlab Release 8.12
        end

        def detected
          ENV.key?('GITLAB_CI') ? self.class : nil
        end

        def fixed_queue_split
          true
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
knapsack_pro-5.3.5 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.3.4 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.3.3 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.3.2 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.3.1 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.3.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.2.1 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.2.0 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.1.2 lib/knapsack_pro/config/ci/gitlab_ci.rb
knapsack_pro-5.1.1 lib/knapsack_pro/config/ci/gitlab_ci.rb