Skip to content

Conversation

jp524
Copy link

@jp524 jp524 commented Jan 25, 2024

Resolves #714.

While configuring mina on my project I noticed deprecation warnings for bundle flags.
I modified the commands in the bundle:install task in my project and would like to offer the same changes here.

Refer to bundle config documentation for current release 2.5.

@Antronin
Copy link

Please merge this as the deprecation is really old and suddenly it will stop working.

Copy link

@TimeTravelerFromNow TimeTravelerFromNow left a comment

Choose a reason for hiding this comment

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

I would really like this change merged as well, without this, we have broken deployments when upgrading. @lovro-bikic can you help?

@Antronin you were right! On main this causes a bug with the correct bundler version not being installed and then a bundle install will fail when upgrading to Rails 8!
Install failure log with a debian vps using rvm

Failing deploy log ❌

-----> Installing gem dependencies using Bundler
       $ bundle install --without development test --path "vendor/bundle" --deployment
       [DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment true`, and stop using this flag
       [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag
       [DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development test'`, and stop using this flag
       Bundler 2.7.1 is running, but your lockfile was generated with 2.5.10. Installing Bundler 2.5.10 and restarting using that version.
       Fetching gem metadata from https://rubygems.org/.
       Installing bundler 2.5.10
       There was an error installing the locked bundler version (2.5.10), rerun with the `--verbose` flag for more details. Going on using bundler 2.7.1.
       [DEPRECATED] Platform :mingw, :mswin, :x64_mingw is deprecated. Please use platform :windows instead.
       [DEPRECATED] Platform :mingw, :x64_mingw is deprecated. Please use platform :windows instead.
       Fetching gem metadata from https://rubygems.org/.........
       Installing rake 13.3.0
       Installing base64 0.3.0
       Installing benchmark 0.4.1
       Installing bigdecimal 3.2.2 with native extensions
       Installing connection_pool 2.5.3
       Installing drb 2.2.3
       Installing logger 1.7.0
       Installing concurrent-ruby 1.3.5
       Installing securerandom 0.4.1
       Installing minitest 5.25.5
       Installing uri 1.0.3
       Installing builder 3.3.0
       Installing erubi 1.13.1
       Installing crass 1.0.6
       Installing racc 1.8.1 with native extensions
       Installing useragent 0.16.11
       Installing rack 3.1.16
       Installing websocket-extensions 0.1.5
       Installing nio4r 2.7.4 with native extensions
       Installing zeitwerk 2.7.3
       Installing timeout 0.4.3
       Installing marcel 1.0.4
       Installing mini_mime 1.1.5
       Installing date 3.4.1 with native extensions
       Installing msgpack 1.8.0 with native extensions
       Installing erb 5.0.2 with native extensions
       Installing execjs 2.8.1
       Installing prettyprint 0.2.0
       Installing stringio 3.1.7 with native extensions
       Installing io-console 0.8.1 with native extensions
       Installing thor 1.4.0
       Installing kgio 2.11.4 with native extensions
       Installing ffi 1.17.2 (x86_64-linux-gnu)
       Installing pg 1.5.9 with native extensions
       Installing raindrops 0.20.1 with native extensions
       Bundler::PermissionError: There was an error while trying to create
       `/usr/local/rvm/gems/ruby-3.3.2/gems/rake-13.3.0`. It is likely that you need to
       grant executable permissions for all parent directories and write permissions
       for `/usr/local/rvm/gems/ruby-3.3.2/gems`.
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/shared_helpers.rb:109:in
       `rescue in filesystem_access'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/shared_helpers.rb:104:in
       `filesystem_access'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/rubygems_gem_installer.rb:22:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/source/rubygems.rb:220:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer/gem_installer.rb:55:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer/gem_installer.rb:17:in
       `install_from_spec'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer/parallel_installer.rb:133:in
       `do_install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer/parallel_installer.rb:87:in
       `call'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer/parallel_installer.rb:66:in
       `call'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer.rb:199:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer.rb:84:in
       `block in run'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/rubygems_ext.rb:39:in
       `block in open_file_with_flock'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/rubygems_ext.rb:34:in
       `open'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/rubygems_ext.rb:34:in
       `open_file_with_flock'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/rubygems_ext.rb:45:in
       `open_file_with_lock'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/process_lock.rb:13:in
       `block in lock'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/shared_helpers.rb:105:in
       `filesystem_access'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/process_lock.rb:12:in
       `lock'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer.rb:71:in
       `run'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/installer.rb:23:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/cli/install.rb:74:in
       `run'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/cli.rb:245:in
       `block in install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/settings.rb:157:in
       `temporary'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/cli.rb:244:in
       `install'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/command.rb:28:in
       `run'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in
       `invoke_command'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor.rb:538:in
       `dispatch'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/cli.rb:35:in
       `dispatch'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/vendor/thor/lib/thor/base.rb:584:in
       `start'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/cli.rb:29:in
       `start'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/exe/bundle:28:in `block in
       <top (required)>'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/lib/bundler/friendly_errors.rb:118:in
       `with_friendly_errors'
       /usr/local/rvm/gems/ruby-3.3.2/gems/bundler-2.7.1/exe/bundle:20:in `<top
       (required)>'
         /usr/local/rvm/gems/ruby-3.3.2/bin/bundle:25:in `load'
         /usr/local/rvm/gems/ruby-3.3.2/bin/bundle:25:in `<main>'
         /usr/local/rvm/gems/ruby-3.3.2/bin/ruby_executable_hooks:22:in `eval'
         /usr/local/rvm/gems/ruby-3.3.2/bin/ruby_executable_hooks:22:in `<main>'
       
       An error occurred while installing rake (13.3.0), and Bundler cannot continue.
       
       In Gemfile:
         importmap-rails was resolved to 2.2.0, which depends on
           railties was resolved to 8.0.2, which depends on
             rake
 !     ERROR: Deploy failed.
-----> Cleaning up build

The error message says there's a permission error even though I checked ls -l /usr/local/rvm/gems/ and it showed with group rvm and my rails app users are in the rvm group so should have proper permissions.

# on VPS
ls -l /usr/local/rvm/
...
drwxrwsr-x  8 root rvm 4096 Jul 24 15:31 gems
...

Approving as well since I tested by monkeypatching my local gem and it succeeds
Successful deployment log ✅

-----> Installing gem dependencies using Bundler
       $ bundle config set --local without 'development test'
       $ bundle config set --local path 'vendor/bundle'
       $ bundle config set --local deployment 'true'
       $ bundle install
       Bundler 2.7.1 is running, but your lockfile was generated with 2.5.10. Installing Bundler 2.5.10 and restarting using that version.
       Fetching gem metadata from https://rubygems.org/.
       Fetching bundler 2.5.10
       Installing bundler 2.5.10
       Fetching gem metadata from https://rubygems.org/.........
       Fetching rake 13.3.0
       Installing rake 13.3.0
...
       Bundle complete! 23 Gemfile dependencies, 83 gems now installed.
       Gems in the groups 'development' and 'test' were not installed.
       Bundled gems are installed into `./vendor/bundle`
-----> DB migrations unchanged; skipping DB migration
-----> Precompiling asset files
       $ RAILS_ENV="production" bundle exec rake assets:precompile
-----> Cleaning up old releases (keeping 5)
       $ cd /home/app-live/app/releases
       $ count=$(ls -A1 | sort -rn | wc -l)
       $ remove=$((count > 5 ? count - 5 : 0))
       $ ls -A1 | sort -rn | tail -n $remove | xargs rm -rf {}
       /home/app-live/app/tmp/build-175345207516397
-----> Deploy finished
-----> Building
-----> Moving build to /home/app-live/app/releases/58
       $ mv "$build_path" "$release_path"
       $ cd "$release_path"
-----> Build finished
-----> Launching
-----> Updating the /home/app-live/app/current symlink
       $ ln -nfs "$release_path" "/home/app-live/app/current"
       $ cd "/home/app-live/current"
       $ sudo systemctl restart app-live
-----> Done. Deployed version 58
       Connection to ##redacted## closed.

       Elapsed time: 159.96 seconds
...

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.

Adopt to new standard of bundle flags [proposed Label] enhancement
3 participants