Skip to content

Attempt to install bundler fails #216

@JasonLunn

Description

@JasonLunn

I have a CI system that runs Ruby tests via bazel inside a docker image, with a dedicated image per bazel version + ruby version that we support.

The docker image is built with the desired bazel version, and ruby is installed via RVM at docker image build time along with the version of bundler we use to generate our Gemfile.lock.

The following error is observed in the PR where I'm attempting to adopt rules_ruby, which indicates that rules_ruby is trying to install bundler-2.4.22 despite it being installed already. It fails, presumably because of bazel sandbox rules.

Is there something I need to do differently to prevent rules_ruby from attempting the installation? Does gem installation ever work when using the system version and if not, should disabling automatic installation of bundler be disabled in this configuration?

ERROR: /workspace/_build/out/external/protobuf_bundle/BUILD:84:15: Installing external/protobuf_bundle/vendor/cache/bundler-2.4.22.gem (@@protobuf_bundle//:bundler-2.4.22) failed: (Exit 1): gem_install_bundler-2.4.22.sh failed: error executing GemInstall command (from target @@protobuf_bundle//:bundler-2.4.22) 
  (cd /workspace/_build/out/sandbox/processwrapper-sandbox/626/execroot/_main && \
  exec env - \
    PATH=/usr/local/rvm/gems/ruby-3.4.1/bin:/usr/local/rvm/gems/ruby-3.4.1@global/bin:/usr/local/rvm/rubies/ruby-3.4.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools:/usr/local/rvm/bin \
  bazel-out/k8-fastbuild/bin/external/protobuf_bundle/gem_install_bundler-2.4.22.sh)
# Configuration: f06f54974fe4ae3926ed7f4362850e99b3c3835650485ceb0f9cae2f7f580429
# Execution platform: @@local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/gems/3.4.0/wrappers directory.
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/gems/3.4.0/gems/gem-wrappers-1.4.0/lib/gem-wrappers/installer.rb:26:in 'GemWrappers::Installer#ensure'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/gems/3.4.0/gems/gem-wrappers-1.4.0/lib/gem-wrappers.rb:19:in 'GemWrappers.install'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/gems/3.4.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb:15:in 'block in <top (required)>'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/installer.rb:367:in 'block in Gem::Installer#run_post_install_hooks'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/installer.rb:366:in 'Array#each'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/installer.rb:366:in 'Gem::Installer#run_post_install_hooks'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/installer.rb:335:in 'Gem::Installer#install'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/resolver/specification.rb:105:in 'Gem::Resolver::Specification#install'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/request_set.rb:281:in 'block in Gem::RequestSet#install_into'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/request_set.rb:273:in 'Array#each'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/request_set.rb:273:in 'Gem::RequestSet#install_into'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/request_set.rb:148:in 'Gem::RequestSet#install'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/commands/install_command.rb:207:in 'Gem::Commands::InstallCommand#install_gem'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/commands/install_command.rb:223:in 'block in Gem::Commands::InstallCommand#install_gems'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/commands/install_command.rb:216:in 'Array#each'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/commands/install_command.rb:216:in 'Gem::Commands::InstallCommand#install_gems'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/commands/install_command.rb:162:in 'Gem::Commands::InstallCommand#execute'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
	/usr/local/rvm/rubies/ruby-3.4.1/lib/ruby/3.4.0/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
	external/ruby/dist/bin/gem:12:in '<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions