-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DD_TAGS
export with nodejs buildpack
#155
Conversation
DD_TAGS
format by detecting language buildpack
DD_TAGS
format by detecting language buildpack DD_TAGS
by detecting language buildpack
DD_TAGS
by detecting language buildpack DD_TAGS
export with nodejs buildpack
lib/scripts/detect_buildpack.sh
Outdated
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2.0 License. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
# Copyright 2022-Present Datadog, Inc. | ||
BUILD_DIR="${BUILD_DIR:-/tmp/app}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUILD_DIR="${BUILD_DIR:-/tmp/app}" | |
VCAP_DIR="/home/vcap" |
The staging_info.yml
file is always extracted to the /home/vcap
directory.
See https://docs.cloudfoundry.org/buildpacks/understand-buildpacks.html#-droplet-filesystem
lib/scripts/utils.sh
Outdated
if [ -n "${LEGACY_TAGS_FORMAT}" ]; then | ||
echo "export LEGACY_TAGS_FORMAT='${LEGACY_TAGS_FORMAT}'" >> "${env_file}" | ||
fi | ||
if [ -n "${DD_DETECTED_BUILDPACK}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of sharing the DD_DETECTED_BUILDPACK
var across all the scripts that output tags. I think it would be better to share a DD_TAGS_SEPARATOR
var instead, and extract the logic of detecting which format to use outside of the scripts, and in a unique location.
lib/scripts/detect_buildpack.sh
Outdated
DD_DETECTED_BUILDPACK="" | ||
if [ -f "${BUILD_DIR}"/staging_info.yml ]; then | ||
DD_DETECTED_BUILDPACK=$(cat "${BUILD_DIR}"/staging_info.yml | jq '.detected_buildpack') | ||
elif [ -f "${BUILD_DIR}"/package-lock.json ] || [ -f "${BUILD_DIR}"/yarn.lock ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif [ -f "${BUILD_DIR}"/package-lock.json ] || [ -f "${BUILD_DIR}"/yarn.lock ]; then | |
elif [ -f "${BUILD_DIR}"/app/package-lock.json ] || [ -f "${BUILD_DIR}"/app/yarn.lock ]; then |
I am not sure if we should go with this approach, but if we do, we'll also have to check for package.json
or node_modules
.
I would also prefer checking the start_command
field in the staging_info.yml
.
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
See #162 |
What does this PR do?
Detects what language buildpack is running by checking
staging.yaml
then falling back to detectingnode
specific files if that file is not available.If the nodejs buildpack is running, then we export
DD_TAGS
as a comma and space separated list. We need to do this because the nodejs tracer does not support exportingDD_TAGS
as spaces.Description of the Change
Alternate Designs
Possible Drawbacks
Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.