Class: KnapsackPro::Config::CI::GitlabCI

Inherits:
Base
  • Object
show all
Defined in:
lib/knapsack_pro/config/ci/gitlab_ci.rb

Instance Method Summary collapse

Methods inherited from Base

#node_retry_count

Instance Method Details

#branchObject



29
30
31
32
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 29

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

#ci_providerObject



51
52
53
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 51

def ci_provider
  "Gitlab CI"
end

#commit_hashObject



24
25
26
27
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 24

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

#detectedObject



43
44
45
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 43

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

#fixed_queue_splitObject



47
48
49
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 47

def fixed_queue_split
  true
end

#node_build_idObject



19
20
21
22
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 19

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

#node_indexObject



12
13
14
15
16
17
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 12

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

#node_totalObject



8
9
10
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 8

def node_total
  ENV['CI_NODE_TOTAL']
end

#project_dirObject



34
35
36
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 34

def project_dir
  ENV['CI_PROJECT_DIR']
end

#test_queue_idObject



55
56
57
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 55

def test_queue_id
  ENV['CI_PIPELINE_ID']
end

#user_seatObject



38
39
40
41
# File 'lib/knapsack_pro/config/ci/gitlab_ci.rb', line 38

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