Sha256: 5a6403c26ad9b2b2fd79e95dc91a80a0af9135323a4ede925c092448cbdbdac3

Contents?: true

Size: 1.52 KB

Versions: 19

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

require_relative "base"

module Datadog
  module CI
    module Ext
      module Environment
        module Providers
          # Travis CI: https://www.travis-ci.com/
          # Environment variables docs: https://docs.travis-ci.com/user/environment-variables#default-environment-variables
          class Travis < Base
            def self.handles?(env)
              env.key?("TRAVIS")
            end

            def provider_name
              "travisci"
            end

            def job_url
              env["TRAVIS_JOB_WEB_URL"]
            end

            def pipeline_id
              env["TRAVIS_BUILD_ID"]
            end

            def pipeline_name
              env["TRAVIS_REPO_SLUG"]
            end

            def pipeline_number
              env["TRAVIS_BUILD_NUMBER"]
            end

            def pipeline_url
              env["TRAVIS_BUILD_WEB_URL"]
            end

            def workspace_path
              env["TRAVIS_BUILD_DIR"]
            end

            def git_repository_url
              "https://github.com/#{env["TRAVIS_REPO_SLUG"]}.git"
            end

            def git_commit_sha
              env["TRAVIS_COMMIT"]
            end

            def git_branch
              env["TRAVIS_PULL_REQUEST_BRANCH"] || env["TRAVIS_BRANCH"]
            end

            def git_tag
              env["TRAVIS_TAG"]
            end

            def git_commit_message
              env["TRAVIS_COMMIT_MESSAGE"]
            end
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
datadog-ci-1.2.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.1.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.1 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.0.beta6 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.0.beta3 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.0.beta2 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-1.0.0.beta1 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.8.3 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.8.2 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.8.1 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.8.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.7.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.6.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.5.1 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.5.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.4.1 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.4.0 lib/datadog/ci/ext/environment/providers/travis.rb
datadog-ci-0.3.0 lib/datadog/ci/ext/environment/providers/travis.rb