Sha256: c39c12a25f7528bd787f4dae84f0831430cc5f06d70803ed005b4de835bc5044

Contents?: true

Size: 983 Bytes

Versions: 12

Compression:

Stored size: 983 Bytes

Contents

# https://docs.semaphoreci.com/article/12-environment-variables
module KnapsackPro
  module Config
    module CI
      class Semaphore2 < Base
        def node_total
          ENV['SEMAPHORE_JOB_COUNT']
        end

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

        def node_build_id
          ENV['SEMAPHORE_WORKFLOW_ID']
        end

        def commit_hash
          ENV['SEMAPHORE_GIT_SHA']
        end

        def branch
          ENV['SEMAPHORE_GIT_BRANCH']
        end

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

        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

        def fixed_queue_split
          false
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
knapsack_pro-5.3.5 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.3.4 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.3.3 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.3.2 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.3.1 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.3.0 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.2.1 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.2.0 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.1.2 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.1.1 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.1.0 lib/knapsack_pro/config/ci/semaphore2.rb
knapsack_pro-5.0.0 lib/knapsack_pro/config/ci/semaphore2.rb