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
Instance Method Summary
collapse
Methods inherited from Base
#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
Instance Method Details
#ci_env_vars ⇒ Object
64
65
66
67
68
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 64
def ci_env_vars
{
"DD_CUSTOM_TRACE_ID" => env["DD_CUSTOM_TRACE_ID"]
}.to_json
end
|
#git_branch_or_tag ⇒ Object
60
61
62
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 60
def git_branch_or_tag
env["GIT_BRANCH"]
end
|
#git_commit_sha ⇒ Object
56
57
58
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 56
def git_commit_sha
env["GIT_COMMIT"]
end
|
#git_repository_url ⇒ Object
52
53
54
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 52
def git_repository_url
env["GIT_URL"] || env["GIT_URL_1"]
end
|
#node_labels ⇒ Object
48
49
50
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 48
def node_labels
env["NODE_LABELS"] && env["NODE_LABELS"].split.to_json
end
|
#node_name ⇒ Object
44
45
46
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 44
def node_name
env["NODE_NAME"]
end
|
#pipeline_id ⇒ Object
20
21
22
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 20
def pipeline_id
env["BUILD_TAG"]
end
|
#pipeline_name ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 24
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
32
33
34
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 32
def pipeline_number
env["BUILD_NUMBER"]
end
|
#pipeline_url ⇒ Object
36
37
38
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 36
def pipeline_url
env["BUILD_URL"]
end
|
#provider_name ⇒ Object
16
17
18
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 16
def provider_name
"jenkins"
end
|
#workspace_path ⇒ Object
40
41
42
|
# File 'lib/datadog/ci/ext/environment/providers/jenkins.rb', line 40
def workspace_path
env["WORKSPACE"]
end
|