Class: Datadog::CI::Ext::Environment::Providers::Gitlab
- Inherits:
-
Base
- Object
- Base
- Datadog::CI::Ext::Environment::Providers::Gitlab
show all
- Defined in:
- lib/datadog/ci/ext/environment/providers/gitlab.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#env
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#git_branch_or_tag, #git_commit_committer_date, #git_commit_committer_email, #git_commit_committer_name, #git_commit_head_author_date, #git_commit_head_author_email, #git_commit_head_author_name, #git_commit_head_committer_date, #git_commit_head_committer_email, #git_commit_head_committer_name, #git_commit_head_message, #initialize
Class Method Details
.handles?(env) ⇒ Boolean
13
14
15
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 13
def self.handles?(env)
env.key?("GITLAB_CI")
end
|
Instance Method Details
#ci_env_vars ⇒ Object
99
100
101
102
103
104
105
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 99
def ci_env_vars
{
"CI_PROJECT_URL" => env["CI_PROJECT_URL"],
"CI_PIPELINE_ID" => env["CI_PIPELINE_ID"],
"CI_JOB_ID" => env["CI_JOB_ID"]
}.to_json
end
|
#git_branch ⇒ Object
73
74
75
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 73
def git_branch
env["CI_COMMIT_REF_NAME"]
end
|
#git_commit_author_date ⇒ Object
91
92
93
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 91
def git_commit_author_date
env["CI_COMMIT_TIMESTAMP"]
end
|
#git_commit_author_email ⇒ Object
86
87
88
89
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 86
def git_commit_author_email
_name, email =
email
end
|
#git_commit_author_name ⇒ Object
81
82
83
84
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 81
def git_commit_author_name
name, _email =
name
end
|
#git_commit_head_sha ⇒ Object
119
120
121
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 119
def git_commit_head_sha
env["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"]
end
|
#git_commit_message ⇒ Object
95
96
97
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 95
def git_commit_message
env["CI_COMMIT_MESSAGE"]
end
|
#git_commit_sha ⇒ Object
69
70
71
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 69
def git_commit_sha
env["CI_COMMIT_SHA"]
end
|
#git_pull_request_base_branch ⇒ Object
107
108
109
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 107
def git_pull_request_base_branch
env["CI_MERGE_REQUEST_TARGET_BRANCH_NAME"]
end
|
#git_pull_request_base_branch_head_sha ⇒ Object
115
116
117
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 115
def git_pull_request_base_branch_head_sha
env["CI_MERGE_REQUEST_TARGET_BRANCH_SHA"]
end
|
#git_pull_request_base_branch_sha ⇒ Object
111
112
113
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 111
def git_pull_request_base_branch_sha
env["CI_MERGE_REQUEST_DIFF_BASE_SHA"]
end
|
#git_repository_url ⇒ Object
65
66
67
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 65
def git_repository_url
env["CI_REPOSITORY_URL"]
end
|
#git_tag ⇒ Object
77
78
79
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 77
def git_tag
env["CI_COMMIT_TAG"]
end
|
#job_id ⇒ Object
21
22
23
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 21
def job_id
env["CI_JOB_ID"]
end
|
#job_name ⇒ Object
25
26
27
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 25
def job_name
env["CI_JOB_NAME"]
end
|
#job_url ⇒ Object
29
30
31
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 29
def job_url
env["CI_JOB_URL"]
end
|
#node_labels ⇒ Object
61
62
63
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 61
def node_labels
env["CI_RUNNER_TAGS"]
end
|
#node_name ⇒ Object
57
58
59
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 57
def node_name
env["CI_RUNNER_ID"]
end
|
#pipeline_id ⇒ Object
33
34
35
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 33
def pipeline_id
env["CI_PIPELINE_ID"]
end
|
#pipeline_name ⇒ Object
37
38
39
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 37
def pipeline_name
env["CI_PROJECT_PATH"]
end
|
#pipeline_number ⇒ Object
41
42
43
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 41
def pipeline_number
env["CI_PIPELINE_IID"]
end
|
#pipeline_url ⇒ Object
45
46
47
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 45
def pipeline_url
env["CI_PIPELINE_URL"]
end
|
#pr_number ⇒ Object
123
124
125
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 123
def pr_number
env["CI_MERGE_REQUEST_IID"]
end
|
#provider_name ⇒ Object
17
18
19
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 17
def provider_name
Provider::GITLAB
end
|
#stage_name ⇒ Object
49
50
51
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 49
def stage_name
env["CI_JOB_STAGE"]
end
|
#workspace_path ⇒ Object
53
54
55
|
# File 'lib/datadog/ci/ext/environment/providers/gitlab.rb', line 53
def workspace_path
env["CI_PROJECT_DIR"]
end
|