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



23
24
25
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 23

def branch
  ENV['SEMAPHORE_GIT_BRANCH']
end

#ci_providerObject



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

def ci_provider
  "Semaphore CI 2.0"
end

#commit_hashObject



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

def commit_hash
  ENV['SEMAPHORE_GIT_SHA']
end

#detectedObject



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

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



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

def fixed_queue_split
  false
end

#node_build_idObject



15
16
17
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 15

def node_build_id
  ENV['SEMAPHORE_WORKFLOW_ID']
end

#node_indexObject



10
11
12
13
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 10

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

#node_totalObject



6
7
8
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 6

def node_total
  ENV['SEMAPHORE_JOB_COUNT']
end

#project_dirObject



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

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

#user_seatObject



33
34
35
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 33

def user_seat
  # not provided
end