Class: Datadog::CI::Ext::Environment::Providers::LocalGit

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

Overview

As a fallback we try to fetch git information from the local git repository

Instance Attribute Summary

Attributes inherited from Base

#env

Instance Method Summary collapse

Methods inherited from Base

#ci_env_vars, #git_branch_or_tag, #git_commit_head_sha, #git_pull_request_base_branch, #git_pull_request_base_branch_head_sha, #git_pull_request_base_branch_sha, handles?, #initialize, #job_id, #job_name, #job_url, #node_labels, #node_name, #pipeline_id, #pipeline_name, #pipeline_number, #pipeline_url, #pr_number, #provider_name, #stage_name

Constructor Details

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

Instance Method Details

#git_branchObject



21
22
23
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 21

def git_branch
  CI::Git::LocalRepository.git_branch
end

#git_commit_author_dateObject



41
42
43
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 41

def git_commit_author_date
  author&.date
end

#git_commit_author_emailObject



37
38
39
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 37

def git_commit_author_email
  author&.email
end

#git_commit_author_nameObject



33
34
35
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 33

def git_commit_author_name
  author&.name
end

#git_commit_committer_dateObject



53
54
55
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 53

def git_commit_committer_date
  committer&.date
end

#git_commit_committer_emailObject



49
50
51
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 49

def git_commit_committer_email
  committer&.email
end

#git_commit_committer_nameObject



45
46
47
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 45

def git_commit_committer_name
  committer&.name
end

#git_commit_head_author_dateObject



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

def git_commit_head_author_date
  head_author&.date
end

#git_commit_head_author_emailObject



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

def git_commit_head_author_email
  head_author&.email
end

#git_commit_head_author_nameObject



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

def git_commit_head_author_name
  head_author&.name
end

#git_commit_head_committer_dateObject



75
76
77
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 75

def git_commit_head_committer_date
  head_committer&.date
end

#git_commit_head_committer_emailObject



79
80
81
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 79

def git_commit_head_committer_email
  head_committer&.email
end

#git_commit_head_committer_nameObject



83
84
85
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 83

def git_commit_head_committer_name
  head_committer&.name
end

#git_commit_head_messageObject



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

def git_commit_head_message
  return nil if head_commit_sha_from_env.nil?

  CI::Git::LocalRepository.git_commit_message(head_commit_sha_from_env)
end

#git_commit_messageObject



29
30
31
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 29

def git_commit_message
  CI::Git::LocalRepository.git_commit_message
end

#git_commit_shaObject



17
18
19
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 17

def git_commit_sha
  CI::Git::LocalRepository.git_commit_sha
end

#git_repository_urlObject



13
14
15
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 13

def git_repository_url
  CI::Git::LocalRepository.git_repository_url
end

#git_tagObject



25
26
27
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 25

def git_tag
  CI::Git::LocalRepository.git_tag
end

#workspace_pathObject



87
88
89
# File 'lib/datadog/ci/ext/environment/providers/local_git.rb', line 87

def workspace_path
  CI::Git::LocalRepository.git_root
end