Skip to content

feat(ruby)!: rewrite to use ruby-build with optional rbenv/rvm (v2.0.0) - #1654

Merged
Abdurrahmaan Iqbal (abdurriq) merged 4 commits into
devcontainers:mainfrom
rhiroe:feat/ruby-v2-ruby-build
Jun 19, 2026
Merged

feat(ruby)!: rewrite to use ruby-build with optional rbenv/rvm (v2.0.0)#1654
Abdurrahmaan Iqbal (abdurriq) merged 4 commits into
devcontainers:mainfrom
rhiroe:feat/ruby-v2-ruby-build

Conversation

@rhiroe

@rhiroe Ryosuke Hiroe (rhiroe) commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is a continuation of #764 (now closed), which itself was opened in response to #757 and #603. It rewrites the Ruby Feature on top of ruby-build and bumps the version to 2.0.0.

Problems with the current v1 implementation

1. RVM's stable channel does not support recent Ruby versions

RVM's stable branch lags behind the upstream Ruby release cycle. As a result, users who need a recent Ruby version (e.g. 3.3.x or later) often cannot install it through the current Feature without workarounds.

2. Both RVM and rbenv are installed unconditionally

The current Feature installs both RVM and rbenv regardless of what the user actually needs. This causes conflicts — in particular, rbenv is effectively unusable when RVM is present because GEM_HOME, GEM_PATH, and MY_RUBY_HOME are all hard-coded to RVM paths in containerEnv. Any version manager the user adds on top will be broken by those static environment variables.

3. A version manager is not always necessary

For the common case where a project targets a single, fixed Ruby version, there is no need for a version manager at all. Installing RVM by default adds unnecessary complexity, startup overhead, and a frequent source of user confusion.

What this PR does

  • Replaces RVM/rbenv with ruby-build as the sole installer. Ruby is installed to /usr/local/rubies/<version>/ and exposed via a /usr/local/rubies/current symlink on the PATH.
  • Removes GEM_HOME, GEM_PATH, and MY_RUBY_HOME from containerEnv. These variables interfere with any version manager or gem tooling the user may add. RubyGems' own dynamic defaults work correctly when these are left unset.
  • Adds a versionManager option (none / rbenv / rvm, default none). Users who need a version manager can opt in explicitly. When rbenv or rvm is selected, ruby-build is wired in as its build back-end.
  • Broadens OS support from Debian/Ubuntu (apt) to also cover RHEL/Fedora (dnf/yum), Alpine (apk), openSUSE (zypper), and Arch (pacman).
  • Adds a shared ruby group owning /usr/local/rubies/ so the non-root container user can run gem install without sudo.
  • Updates test scenarios to cover the rbenv and rvm paths, and removes the now-unnecessary ruby_fallback_test.

Relationship to previous work

This PR picks up directly from #764. The approach here aligns with the consensus reached in #757: ruby-build as the default, version managers as opt-in, and no static GEM_HOME/GEM_PATH.

Breaking changes

  • GEM_HOME, GEM_PATH, and MY_RUBY_HOME are no longer set by the Feature. Projects that relied on these values being set to RVM paths will need to update their configuration.
  • The Feature version is bumped to 2.0.0 to signal the backward-incompatible change.
  • RVM is no longer installed by default. Use "versionManager": "rvm" to restore the previous behaviour.

Comment thread src/ruby/install.sh Outdated
Comment thread test/ruby/scenarios.json Outdated
Comment thread test/ruby/scenarios.json Outdated
Replace the rvm-only install with ruby-build under /usr/local/rubies,
exposed via the 'current' symlink on the PATH. Add a versionManager
option ("none" | "rbenv" | "rvm") that installs the chosen manager
and delegates 'install' to it.

Detect build deps across apt, dnf/yum, apk, zypper, and pacman.
Replace ruby_fallback_test with ruby_rbenv / ruby_rvm scenarios.
@rhiroe

Copy link
Copy Markdown
Contributor Author

Kaniska (@Kaniska244) Thanks for the review! I've addressed your feedback in 07e07de. Note that the commit was squashed via fixup to keep the commit log clean.

@Kaniska244 Kaniska (Kaniska244) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be further reviewed by maintainers.

Comment thread src/ruby/NOTES.md
Comment thread test/ruby/install_additional_ruby_trixie.sh Outdated
@abdurriq
Abdurrahmaan Iqbal (abdurriq) merged commit 71d6d23 into devcontainers:main Jun 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants