Skip to content

Commit

Permalink
Add ruby as a dependency for datadog integration
Browse files Browse the repository at this point in the history
- Download the ruby binary
- Append the ruby binary path to the PATH env var before the DD startup script
  • Loading branch information
pappachino committed Jan 11, 2024
1 parent 6874bc6 commit fc699a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions buildpack/telemetry/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,19 @@ def _set_up_environment(model_version, runtime_version):
e["DD_ENABLE_CHECKS"] = str(bool(_is_checks_enabled())).lower()
e["LOGS_CONFIG"] = json.dumps(_get_logging_config())

# Append the ruby binary path
ruby_path = os.path.join(ROOT_DIR, "ruby", "bin")
e["PATH"] += os.pathsep + ruby_path

# Add an empty .global_env file as the DD buildpack expects a .global_env
# This is in parity with how the DD buildpack sets up the environment before
# installing the DD agents. Sourced from bin/supply scripts
# https://github.com/DataDog/datadog-cloudfoundry-buildpack/blob/master/bin/supply#L31
# Keeping it empty as we're already adding the RUBY path as part of process env
global_env_file = os.path.join(_get_agent_dir(), ".global_env")
with open(global_env_file, mode='a'):
pass

return e


Expand Down Expand Up @@ -492,6 +505,16 @@ def update_config(


def _download(buildpack_dir, build_path, cache_dir):
# DD for cflinuxfs4 requires ruby to be available, so installing
# the ruby dependency first before we proceed
# https://github.com/DataDog/datadog-cloudfoundry-buildpack/pull/174
util.resolve_dependency(
"ruby",
os.path.join(build_path, "ruby"),
buildpack_dir=buildpack_dir,
cache_dir=cache_dir,
)

util.resolve_dependency(
f"{NAMESPACE}.buildpack",
os.path.join(build_path, NAMESPACE),
Expand Down
5 changes: 5 additions & 0 deletions dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ dependencies:
fs: cflinuxfs4
cpe: cpe:2.3:a:f5:nginx:{{ version }}:*:*:*:*:*:*:*
version: 1.22.1
ruby:
artifact: ruby/ruby_{{ version }}_linux_x64_{{ fs }}_{{ commit }}.tgz
commit: 5fed98f8
fs: cflinuxfs4
version: 3.2.2
telegraf:
agent:
artifact: telegraf/telegraf-{{ version }}_linux_amd64.tar.gz
Expand Down

0 comments on commit fc699a1

Please sign in to comment.