Fix Ruby installation failures in update:tool-versions rake task
Overview
In #2412 (closed), the update-tool-versions
rake task skips Ruby versions when installing combined tool versions. We need to do this because Ruby installation fails with Bundler errors when trying to install a new Ruby version from within another Ruby environment.
For example, when the rake task runs in Ruby 3.3.7 and tries to install Ruby 3.4.2, we get errors like:
Generating RDoc documentation
/Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/definition.rb:594:in 'Bundler::Definition#materialize': Could not find lefthook-1.10.10, rubocop-1.68.0, rubocop-rake-0.6.0, yard-0.9.37, pry-byebug-3.10.1, gitlab-styles-13.0.2, irb-1.15.1, rspec-3.13.0, rspec_junit_formatter-0.6.0, simplecov-cobertura-2.1.0, webmock-3.25.0, gitlab-dangerfiles-4.8.1, resolv-0.6.0, gitlab-sdk-0.3.1, sentry-ruby-5.17.1, tty-markdown-0.7.2, tty-spinner-0.9.3, zeitwerk-2.6.15, json-2.7.2, language_server-protocol-3.17.0.3, parallel-1.25.1, parser-3.3.3.0, rainbow-3.1.1, regexp_parser-2.9.2, rubocop-ast-1.32.3, ruby-progressbar-1.13.0, unicode-display_width-2.5.0, byebug-11.1.3, pry-0.14.2, rubocop-capybara-2.21.0, rubocop-factory_bot-2.26.1, rubocop-graphql-1.5.4, rubocop-performance-1.21.1, rubocop-rails-2.26.2, rubocop-rspec-3.0.5, rubocop-rspec_rails-2.30.0, pp-0.6.2, rdoc-6.6.3.1, reline-0.5.9, rspec-core-3.13.0, rspec-expectations-3.13.0, rspec-mocks-3.13.0, rexml-3.3.1, simplecov-0.21.2, addressable-2.8.7, crack-1.0.0, hashdiff-1.1.1, danger-9.4.3, danger-gitlab-8.0.0, activesupport-7.1.3.4, snowplow-tracker-0.8.0, concurrent-ruby-1.3.3, kramdown-2.4.0, pastel-0.8.0, rouge-4.4.0, strings-0.2.1, tty-color-0.6.0, tty-screen-0.8.2, tty-cursor-0.7.1, ast-2.4.2, racc-1.8.0, coderay-1.1.3, method_source-1.0.0, rack-3.1.8, prettyprint-0.2.0, psych-5.1.2, io-console-0.7.2, rspec-support-3.13.0, diff-lcs-1.5.1, strscan-3.1.0, docile-1.4.0, simplecov-html-0.12.3, simplecov_json_formatter-0.1.4, public_suffix-5.1.1, claide-1.1.0, claide-plugins-0.9.2, colored2-3.1.2, cork-0.3.0, faraday-2.9.2, faraday-http-cache-2.5.1, git-1.19.1, kramdown-parser-gfm-1.1.0, no_proxy_fix-0.1.2, octokit-6.1.1, terminal-table-3.0.2, gitlab-4.20.1, connection_pool-2.4.1, i18n-1.14.5, minitest-5.24.1, mutex_m-0.2.0, tzinfo-2.0.6, strings-ansi-0.2.0, unicode_utils-1.4.0, stringio-3.1.1, nap-1.1.0, open4-1.3.4, faraday-net_http-3.1.0, rchardet-1.8.0, sawyer-0.9.2, httparty-0.22.0, net-http-0.4.1, csv-3.3.0, mini_mime-1.1.5, multi_xml-0.7.1, uri-0.13.0 in locally installed gems (Bundler::GemNotFound)
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/definition.rb:193:in 'Bundler::Definition#specs'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/definition.rb:259:in 'Bundler::Definition#specs_for'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/runtime.rb:18:in 'Bundler::Runtime#setup'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler.rb:163:in 'Bundler.setup'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in 'block in <top (required)>'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:159:in 'Bundler::UI::Shell#with_level'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:111:in 'Bundler::UI::Shell#silence'
from /Users/naohashizume/.local/share/mise/installs/ruby/3.3.7/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in '<top (required)>'
from <internal:/private/var/folders/1j/k596c0t14f57nmr5pdr4m1yc0000gn/T/ruby-build.20250228165438.65682.fn5kou/ruby-3.4.2/lib/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
from <internal:/private/var/folders/1j/k596c0t14f57nmr5pdr4m1yc0000gn/T/ruby-build.20250228165438.65682.fn5kou/ruby-3.4.2/lib/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
from /private/var/folders/1j/k596c0t14f57nmr5pdr4m1yc0000gn/T/ruby-build.20250228165438.65682.fn5kou/ruby-3.4.2/lib/rubygems.rb:1407:in '<top (required)>'
from /private/var/folders/1j/k596c0t14f57nmr5pdr4m1yc0000gn/T/ruby-build.20250228165438.65682.fn5kou/ruby-3.4.2/lib/rdoc/rdoc.rb:548:in 'Kernel#require'
from /private/var/folders/1j/k596c0t14f57nmr5pdr4m1yc0000gn/T/ruby-build.20250228165438.65682.fn5kou/ruby-3.4.2/lib/rdoc/rdoc.rb:548:in '<top (required)>'
from ./tool/rdoc-srcdir:4:in 'Kernel#require'
from ./tool/rdoc-srcdir:4:in '<main>'
make: *** [rdoc] Error 1
external command failed with status 2
We need to fix this either through the rake task or other solutions so that when subprojects update their Ruby versions, we can install these new versions immediately instead of waiting for component upgrades to handle Ruby installation.
Steps to replicate
- Check out the
2412-combine-tool-versions-and-install-before-update
branch - Add
3.4.2
to thegitlab/.tool-versions
file - Comment out the line
next nil if tool == 'ruby'
inlib/gdk/tool_versions_updater.rb
- Run
GDK_SELF_UPDATE=0 gdk update
Impacted categories
The following categories relate to this issue:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Edited by Nao Hashizume