Module: Datadog::CI::Ext::Environment
- Defined in:
- lib/datadog/ci/ext/environment.rb,
lib/datadog/ci/ext/environment/extractor.rb,
lib/datadog/ci/ext/environment/providers.rb,
lib/datadog/ci/ext/environment/providers/base.rb,
lib/datadog/ci/ext/environment/providers/azure.rb,
lib/datadog/ci/ext/environment/providers/buddy.rb,
lib/datadog/ci/ext/environment/providers/gitlab.rb,
lib/datadog/ci/ext/environment/providers/travis.rb,
lib/datadog/ci/ext/environment/providers/bitrise.rb,
lib/datadog/ci/ext/environment/providers/jenkins.rb,
lib/datadog/ci/ext/environment/providers/appveyor.rb,
lib/datadog/ci/ext/environment/providers/circleci.rb,
lib/datadog/ci/ext/environment/providers/teamcity.rb,
lib/datadog/ci/ext/environment/providers/bitbucket.rb,
lib/datadog/ci/ext/environment/providers/buildkite.rb,
lib/datadog/ci/ext/environment/providers/codefresh.rb,
lib/datadog/ci/ext/environment/providers/local_git.rb,
lib/datadog/ci/ext/environment/providers/github_actions.rb,
lib/datadog/ci/ext/environment/providers/aws_code_pipeline.rb,
lib/datadog/ci/ext/environment/providers/user_defined_tags.rb
Overview
Defines constants for CI tags
Defined Under Namespace
Modules: Provider, Providers
Classes: Extractor
Constant Summary
collapse
- TAG_JOB_NAME =
"ci.job.name"
- TAG_JOB_URL =
"ci.job.url"
- TAG_PIPELINE_ID =
"ci.pipeline.id"
- TAG_PIPELINE_NAME =
"ci.pipeline.name"
- TAG_PIPELINE_NUMBER =
"ci.pipeline.number"
- TAG_PIPELINE_URL =
"ci.pipeline.url"
- TAG_PROVIDER_NAME =
"ci.provider.name"
- TAG_STAGE_NAME =
"ci.stage.name"
- TAG_WORKSPACE_PATH =
"ci.workspace_path"
- TAG_NODE_LABELS =
"ci.node.labels"
- TAG_NODE_NAME =
"ci.node.name"
- TAG_CI_ENV_VARS =
"_dd.ci.env_vars"
- POSSIBLE_BUNDLE_LOCATIONS =
%w[vendor/bundle .bundle].freeze
Class Method Summary
collapse
Class Method Details
.ensure_post_conditions(tags) ⇒ Object
67
68
69
70
|
# File 'lib/datadog/ci/ext/environment.rb', line 67
def ensure_post_conditions(tags)
validate_repository_url(tags[Git::TAG_REPOSITORY_URL])
validate_git_sha(tags[Git::TAG_COMMIT_SHA])
end
|
.validate_git_sha(git_sha) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/datadog/ci/ext/environment.rb', line 78
def validate_git_sha(git_sha)
return if Utils::Git.valid_commit_sha?(git_sha)
message = "DD_GIT_COMMIT_SHA must be a full-length git SHA."
message += if git_sha.nil? || git_sha.empty?
" No value was set and no SHA was automatically extracted."
elsif git_sha.length < Git::SHA_LENGTH
" Expected SHA length #{Git::SHA_LENGTH}, was #{git_sha.length}."
else
" Expected SHA to be a valid HEX number, got #{git_sha}."
end
Datadog.logger.error(message)
end
|
.validate_repository_url(repo_url) ⇒ Object
72
73
74
75
76
|
# File 'lib/datadog/ci/ext/environment.rb', line 72
def validate_repository_url(repo_url)
return if !repo_url.nil? && !repo_url.empty?
Datadog.logger.error("DD_GIT_REPOSITORY_URL is not set or empty; no repo URL was automatically extracted")
end
|