Skip to content

Commit

Permalink
Merge pull request #347 from DataDog/ara.pulido/fix_forward_slashes
Browse files Browse the repository at this point in the history
Avoid promoting backslashes to DD_TAGS
  • Loading branch information
arapulido committed Sep 1, 2023
2 parents 6bb34a1 + d80b32f commit 8d0b795
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.13] - 2023-09-01

### Fixed
- Avoid promoting backslashes to DD_TAGS.

## [2.12] - 2023-08-31

### Added
Expand Down
7 changes: 4 additions & 3 deletions extra/datadog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ done
# Add tags to the config file
DYNOHOST="$(hostname )"
DYNOTYPE=${DYNO%%.*}
BUILDPACKVERSION="dev"
BUILDPACKVERSION="2.13"
DYNO_TAGS="dyno:$DYNO dynotype:$DYNOTYPE buildpackversion:$BUILDPACKVERSION"

# We want always to have the Dyno ID as a host alias to improve correlation
Expand Down Expand Up @@ -287,8 +287,8 @@ fi
# Convert comma delimited tags from env vars to yaml
if [ -n "$DD_TAGS" ]; then
DD_TAGS_NORMALIZED="$(sed "s/,[ ]\?/\ /g" <<< "$DD_TAGS")"
DD_TAGS_NORMALIZED="$(sed 's/\//\\\//g' <<< "$DD_TAGS_NORMALIZED")"
DD_TAGS="$DYNO_TAGS $DD_TAGS_NORMALIZED"
DD_TAGS_NORMALIZED_YAML="$(sed 's/\//\\\//g' <<< "$DD_TAGS_NORMALIZED")"
else
DD_TAGS="$DYNO_TAGS"
fi
Expand All @@ -297,9 +297,10 @@ export DD_VERSION="$DD_VERSION"
export DD_TAGS="$DD_TAGS"
if [ "$DD_LOG_LEVEL_LOWER" == "debug" ]; then
echo "[DEBUG] Buildpack normalized tags: $DD_TAGS_NORMALIZED"
echo "[DEBUG] Buildpack normalized tags to yaml: $DD_TAGS_NORMALIZED_YAML"
fi

DD_TAGS_YAML="tags:\n - $(sed 's/\ /\\n - /g' <<< "$DD_TAGS")"
DD_TAGS_YAML="tags:\n - $(sed 's/\ /\\n - /g' <<< "$DD_TAGS_NORMALIZED_YAML")"

# Inject tags after example tags.
# Config files for agent versions 6.11 and earlier:
Expand Down

0 comments on commit 8d0b795

Please sign in to comment.