Class: Datadog::CI::Ext::Environment::Providers::Circleci

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/ci/ext/environment/providers/circleci.rb

Overview

Instance Attribute Summary

Attributes inherited from Base

#env

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#additional_tags, #git_branch_or_tag, #git_commit_author_date, #git_commit_committer_date, #git_commit_committer_email, #git_commit_committer_name, #initialize, #node_labels, #node_name, #pipeline_number, #stage_name

Constructor Details

This class inherits a constructor from Datadog::CI::Ext::Environment::Providers::Base

Class Method Details

.handles?(env) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 15

def self.handles?(env)
  env.key?("CIRCLECI")
end

Instance Method Details

#ci_env_varsObject



75
76
77
78
79
80
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 75

def ci_env_vars
  {
    "CIRCLE_WORKFLOW_ID" => env["CIRCLE_WORKFLOW_ID"],
    "CIRCLE_BUILD_NUM" => env["CIRCLE_BUILD_NUM"]
  }.to_json
end

#git_branchObject



55
56
57
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 55

def git_branch
  env["CIRCLE_BRANCH"]
end

#git_commit_author_emailObject



67
68
69
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 67

def git_commit_author_email
  env["BUILD_REQUESTEDFOREMAIL"]
end

#git_commit_author_nameObject



63
64
65
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 63

def git_commit_author_name
  env["BUILD_REQUESTEDFORID"]
end

#git_commit_messageObject



71
72
73
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 71

def git_commit_message
  env["BUILD_SOURCEVERSIONMESSAGE"]
end

#git_commit_shaObject



51
52
53
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 51

def git_commit_sha
  env["CIRCLE_SHA1"]
end

#git_repository_urlObject



47
48
49
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 47

def git_repository_url
  env["CIRCLE_REPOSITORY_URL"]
end

#git_tagObject



59
60
61
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 59

def git_tag
  env["CIRCLE_TAG"]
end

#job_nameObject



27
28
29
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 27

def job_name
  env["CIRCLE_JOB"]
end

#job_urlObject



23
24
25
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 23

def job_url
  env["CIRCLE_BUILD_URL"]
end

#pipeline_idObject



31
32
33
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 31

def pipeline_id
  env["CIRCLE_WORKFLOW_ID"]
end

#pipeline_nameObject



35
36
37
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 35

def pipeline_name
  env["CIRCLE_PROJECT_REPONAME"]
end

#pipeline_urlObject



39
40
41
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 39

def pipeline_url
  "https://app.circleci.com/pipelines/workflows/#{env["CIRCLE_WORKFLOW_ID"]}"
end

#provider_nameObject



19
20
21
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 19

def provider_name
  Provider::CIRCLECI
end

#workspace_pathObject



43
44
45
# File 'lib/datadog/ci/ext/environment/providers/circleci.rb', line 43

def workspace_path
  env["CIRCLE_WORKING_DIRECTORY"]
end