Class: Datadog::CI::Ext::Environment::Providers::Jenkins
- Inherits:
-
Base
- Object
- Base
- Datadog::CI::Ext::Environment::Providers::Jenkins
show all
- Defined in:
- lib/datadog/ci/ext/environment/providers/jenkins.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, #git_commit_author_date, #git_commit_author_email, #git_commit_author_name, #git_commit_committer_date, #git_commit_committer_email, #git_commit_committer_name, #git_commit_message, #git_tag, #initialize, #job_name, #job_url, #stage_name
Class Method Details
.handles?(env) ⇒ Boolean
16
17
18
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 16
def self.handles?(env)
env.key?("JENKINS_URL")
end
|
Instance Method Details
#ci_env_vars ⇒ Object
68
69
70
71
72
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 68
def ci_env_vars
{
"DD_CUSTOM_TRACE_ID" => env["DD_CUSTOM_TRACE_ID"]
}.to_json
end
|
#git_branch_or_tag ⇒ Object
64
65
66
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 64
def git_branch_or_tag
env["GIT_BRANCH"]
end
|
#git_commit_sha ⇒ Object
60
61
62
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 60
def git_commit_sha
env["GIT_COMMIT"]
end
|
#git_repository_url ⇒ Object
56
57
58
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 56
def git_repository_url
env["GIT_URL"] || env["GIT_URL_1"]
end
|
#node_labels ⇒ Object
52
53
54
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 52
def node_labels
env["NODE_LABELS"] && env["NODE_LABELS"].split.to_json
end
|
#node_name ⇒ Object
48
49
50
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 48
def node_name
env["NODE_NAME"]
end
|
#pipeline_id ⇒ Object
24
25
26
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 24
def pipeline_id
env["BUILD_TAG"]
end
|
#pipeline_name ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 28
def pipeline_name
if (name = env["JOB_NAME"])
name = name.gsub("/#{Datadog::CI::Utils::Git.normalize_ref(git_branch)}", "") if git_branch
name = name.split("/").reject { |v| v.nil? || v.include?("=") }.join("/")
end
name
end
|
#pipeline_number ⇒ Object
36
37
38
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 36
def pipeline_number
env["BUILD_NUMBER"]
end
|
#pipeline_url ⇒ Object
40
41
42
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 40
def pipeline_url
env["BUILD_URL"]
end
|
#provider_name ⇒ Object
20
21
22
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 20
def provider_name
Provider::JENKINS
end
|
#workspace_path ⇒ Object
44
45
46
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 44
def workspace_path
env["WORKSPACE"]
end
|