Skip to content

Use absolute path to bundled Ruby instead of PATH#260

Closed
NouemanKHAL wants to merge 3 commits into
masterfrom
noueman/ruby-absolute-path
Closed

Use absolute path to bundled Ruby instead of PATH#260
NouemanKHAL wants to merge 3 commits into
masterfrom
noueman/ruby-absolute-path

Conversation

@NouemanKHAL

@NouemanKHAL NouemanKHAL commented May 14, 2026

Copy link
Copy Markdown
Member

The buildpack ships its own Ruby 3.0.5 for internal scripts (get_tags.rb, update_datadog_config.rb, nc.rb, etc.). On stacks without system Ruby, .global_env was prepending /home/vcap/deps/N/bin to PATH so those scripts could find ruby. That can shadow the chained ruby_buildpack's ruby / gem / bundle for the application, and also means our scripts may run under whatever Ruby the user shipped instead of the 3.0.5 we test against.

Always install the bundled Ruby and expose it as $DD_RUBY via .global_env instead of mutating PATH. Every callsite (run-datadog.sh, test-endpoint.sh, update_agent_config.sh, utils.sh) now uses "$DD_RUBY" directly. App PATH is left alone.

Local bash -n passes for all touched scripts. Wants a real cf push against a Ruby sample to confirm the app's ruby lookup is unaffected.

Before, the buildpack relied on the app's `ruby` being on PATH at
runtime. Two problems with that:

- On stacks without system Ruby (cflinuxfs4), the runtime `.global_env`
  conditionally prepended /home/vcap/deps/N/bin to PATH — which means
  the buildpack's Ruby 3.0.5 could shadow ruby_buildpack's Ruby when the
  Datadog buildpack was the launch buildpack in the chain, surprising
  Ruby apps with a different runtime.
- The buildpack's scripts (get_tags.rb, update_datadog_config.rb, etc.)
  could end up running under whatever Ruby the user shipped, not the
  3.0.5 we test against.

Change: always install the bundled Ruby into $DEPS_DIR/$DEPS_IDX/bin
at staging time, write `export DD_RUBY=/home/vcap/deps/$DEPS_IDX/bin/ruby`
into `.global_env` (no PATH mutation), and have every runtime callsite
use "$DD_RUBY" instead of bare `ruby`.

Callsites updated: run-datadog.sh, test-endpoint.sh, update_agent_config.sh,
utils.sh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NouemanKHAL
NouemanKHAL requested a review from a team as a code owner May 14, 2026 23:18
@NouemanKHAL NouemanKHAL added the changelog/Fixed Fixed features results into a bug fix version bump label May 14, 2026
Kyle-Neale
Kyle-Neale previously approved these changes May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Fixed Fixed features results into a bug fix version bump mergequeue-status: removed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants