Sha256: 0995a5d44129592fbab395b2d44cc3279ef121730e177823e2007d1a93f36b2f

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require "json"

require_relative "base"

module Datadog
  module CI
    module Ext
      module Environment
        module Providers
          # Codefresh: https://codefresh.io/
          # Environment variables docs: https://codefresh.io/docs/docs/pipelines/variables/#export-variables-to-all-steps-with-cf_export
          class Codefresh < Base
            def self.handles?(env)
              env.key?("CF_BUILD_ID")
            end

            def provider_name
              Provider::CODEFRESH
            end

            def job_name
              env["CF_STEP_NAME"]
            end

            def pipeline_id
              env["CF_BUILD_ID"]
            end

            def pipeline_name
              env["CF_PIPELINE_NAME"]
            end

            def pipeline_url
              env["CF_BUILD_URL"]
            end

            def git_branch_or_tag
              env["CF_BRANCH"]
            end

            def ci_env_vars
              {
                "CF_BUILD_ID" => env["CF_BUILD_ID"]
              }.to_json
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
datadog-ci-1.12.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.11.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.10.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.9.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.8.1 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.8.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.7.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.6.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.5.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.4.1 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.4.0 lib/datadog/ci/ext/environment/providers/codefresh.rb
datadog-ci-1.3.0 lib/datadog/ci/ext/environment/providers/codefresh.rb