Class: KnapsackPro::Config::CI::Semaphore2

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

Instance Method Summary collapse

Methods inherited from Base

#node_retry_count, #test_queue_id

Instance Method Details

#branchObject



25
26
27
28
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 25

def branch
  ENV['SEMAPHORE_GIT_WORKING_BRANCH'] || # nil when workflow is triggered by pushing a Git tag
    ENV['SEMAPHORE_GIT_BRANCH']
end

#ci_providerObject



49
50
51
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 49

def ci_provider
  "Semaphore CI 2.0"
end

#commit_hashObject



21
22
23
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 21

def commit_hash
  ENV['SEMAPHORE_GIT_SHA']
end

#detectedObject



40
41
42
43
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 40

def detected
  # check 2 keys to be sure we are using Semaphore 2.0
  ENV.key?('SEMAPHORE') && ENV.key?('SEMAPHORE_WORKFLOW_ID') ? self.class : nil
end

#fixed_queue_splitObject



45
46
47
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 45

def fixed_queue_split
  false
end

#node_build_idObject



17
18
19
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 17

def node_build_id
  ENV['SEMAPHORE_WORKFLOW_ID']
end

#node_indexObject



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

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

#node_totalObject



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

def node_total
  ENV['SEMAPHORE_JOB_COUNT']
end

#project_dirObject



30
31
32
33
34
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 30

def project_dir
  if ENV['HOME'] && ENV['SEMAPHORE_GIT_DIR']
    "#{ENV['HOME']}/#{ENV['SEMAPHORE_GIT_DIR']}"
  end
end

#user_seatObject



36
37
38
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 36

def user_seat
  ENV['SEMAPHORE_GIT_COMMITTER']
end