Use absolute path to bundled Ruby instead of PATH#260
Closed
NouemanKHAL wants to merge 3 commits into
Closed
Conversation
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>
Kyle-Neale
previously approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_envwas prepending/home/vcap/deps/N/binto PATH so those scripts could findruby. That can shadow the chainedruby_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_RUBYvia.global_envinstead 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 -npasses for all touched scripts. Wants a realcf pushagainst a Ruby sample to confirm the app'srubylookup is unaffected.