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

Instance Method Details

#branchObject



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

def branch
  ENV['SEMAPHORE_GIT_BRANCH']
end

#ci_providerObject



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

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



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

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



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

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



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

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

#user_seatObject



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

def user_seat
  # not provided
end