Class: Datadog::CI::Ext::Environment::Providers::Buildkite
- Inherits:
-
Base
- Object
- Base
- Datadog::CI::Ext::Environment::Providers::Buildkite
show all
- Defined in:
- lib/datadog/ci/ext/environment/providers/buildkite.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, #job_name, #stage_name
Class Method Details
.handles?(env) ⇒ Boolean
15
16
17
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 15
def self.handles?(env)
env.key?("BUILDKITE")
end
|
Instance Method Details
#ci_env_vars ⇒ Object
88
89
90
91
92
93
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 88
def ci_env_vars
{
"BUILDKITE_BUILD_ID" => env["BUILDKITE_BUILD_ID"],
"BUILDKITE_JOB_ID" => env["BUILDKITE_JOB_ID"]
}.to_json
end
|
#git_branch ⇒ Object
68
69
70
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 68
def git_branch
env["BUILDKITE_BRANCH"]
end
|
#git_commit_author_email ⇒ Object
80
81
82
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 80
def git_commit_author_email
env["BUILDKITE_BUILD_AUTHOR_EMAIL"]
end
|
#git_commit_author_name ⇒ Object
76
77
78
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 76
def git_commit_author_name
env["BUILDKITE_BUILD_AUTHOR"]
end
|
#git_commit_message ⇒ Object
84
85
86
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 84
def git_commit_message
env["BUILDKITE_MESSAGE"]
end
|
#git_commit_sha ⇒ Object
64
65
66
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 64
def git_commit_sha
env["BUILDKITE_COMMIT"]
end
|
#git_repository_url ⇒ Object
60
61
62
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 60
def git_repository_url
env["BUILDKITE_REPO"]
end
|
#git_tag ⇒ Object
72
73
74
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 72
def git_tag
env["BUILDKITE_TAG"]
end
|
#job_url ⇒ Object
23
24
25
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 23
def job_url
"#{env["BUILDKITE_BUILD_URL"]}##{env["BUILDKITE_JOB_ID"]}"
end
|
#node_labels ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 47
def node_labels
labels = env
.select { |key| key.start_with?("BUILDKITE_AGENT_META_DATA_") }
.map { |key, value| "#{key.to_s.sub("BUILDKITE_AGENT_META_DATA_", "").downcase}:#{value}" }
.sort_by(&:length)
labels.to_json unless labels.empty?
end
|
#node_name ⇒ Object
43
44
45
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 43
def node_name
env["BUILDKITE_AGENT_ID"]
end
|
#pipeline_id ⇒ Object
27
28
29
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 27
def pipeline_id
env["BUILDKITE_BUILD_ID"]
end
|
#pipeline_name ⇒ Object
31
32
33
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 31
def pipeline_name
env["BUILDKITE_PIPELINE_SLUG"]
end
|
#pipeline_number ⇒ Object
35
36
37
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 35
def pipeline_number
env["BUILDKITE_BUILD_NUMBER"]
end
|
#pipeline_url ⇒ Object
39
40
41
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 39
def pipeline_url
env["BUILDKITE_BUILD_URL"]
end
|
#provider_name ⇒ Object
19
20
21
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 19
def provider_name
Provider::BUILDKITE
end
|
#workspace_path ⇒ Object
56
57
58
|
# File 'lib/datadog/ci/ext/environment/providers/buildkite.rb', line 56
def workspace_path
env["BUILDKITE_BUILD_CHECKOUT_PATH"]
end
|