Class: KnapsackPro::Config::CI::Semaphore2
- Defined in:
- lib/knapsack_pro/config/ci/semaphore2.rb
Instance Method Summary collapse
- #branch ⇒ Object
- #ci_provider ⇒ Object
- #commit_hash ⇒ Object
- #detected ⇒ Object
- #fixed_queue_split ⇒ Object
- #node_build_id ⇒ Object
- #node_index ⇒ Object
- #node_total ⇒ Object
- #project_dir ⇒ Object
- #user_seat ⇒ Object
Methods inherited from Base
Instance Method Details
#branch ⇒ Object
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_provider ⇒ Object
49 50 51 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 49 def ci_provider "Semaphore CI 2.0" end |
#commit_hash ⇒ Object
21 22 23 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 21 def commit_hash ENV['SEMAPHORE_GIT_SHA'] end |
#detected ⇒ Object
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_split ⇒ Object
45 46 47 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 45 def fixed_queue_split false end |
#node_build_id ⇒ Object
17 18 19 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 17 def node_build_id ENV['SEMAPHORE_WORKFLOW_ID'] end |
#node_index ⇒ Object
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_total ⇒ Object
8 9 10 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 8 def node_total ENV['SEMAPHORE_JOB_COUNT'] end |
#project_dir ⇒ Object
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_seat ⇒ Object
36 37 38 |
# File 'lib/knapsack_pro/config/ci/semaphore2.rb', line 36 def user_seat ENV['SEMAPHORE_GIT_COMMITTER'] end |