keygen-sh / keygen-api

Keygen is a fair source software licensing and distribution API built with Ruby on Rails. For developers, by developers.
https://keygen.sh
Other
824 stars 53 forks source link

NO_* environment variables should affect gem dependencies during install #728

Open ezekg opened 1 year ago

ezekg commented 1 year ago

E.g. setting NO_RAILS_AUTOSCALE should not install the rails-autoscale gem when running bundle install.

tyler71 commented 3 weeks ago

Setting NO_* variables breaks the Docker image for me: keygen/api:v1.3

Tested with

Example error from setting one of these, which crashes the command.

Running command: bundle exec rails server -b 0.0.0.0 -p 3325
/usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/definition.rb:414:in `ensure_equivalent_gemfile_and_lockfile': , but the lockfile can't be updated because frozen mode is set (Bundler::ProductionError) 

You have deleted from the Gemfile:
* sentry-rails
* sentry-ruby
* sentry-sidekiq
* stackprof

Run `bundle install` elsewhere and add the updated Gemfile to version control.
If this is a development machine, remove the Gemfile.lock freeze by running `bundle config set frozen false`.
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/runtime.rb:13:in `setup'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler.rb:164:in `setup'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/setup.rb:32:in `block in <top (required)>'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/ui/shell.rb:159:in `with_level'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/ui/shell.rb:111:in `silence'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/setup.rb:32:in `<top (required)>'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli/exec.rb:56:in `require_relative'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli/exec.rb:56:in `kernel_load'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli/exec.rb:23:in `run'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli.rb:455:in `exec'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli.rb:35:in `dispatch'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/cli.rb:29:in `start'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/exe/bundle:28:in `block in <top (required)>'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
  from /usr/local/bundle/ruby/3.3.0/gems/bundler-2.5.13/exe/bundle:20:in `<top (required)>'
  from /usr/local/bin/bundle:25:in `load'
  from /usr/local/bin/bundle:25:in `<main>'
  from /usr/local/bin/bundle:25:in `load'
  from /usr/local/bin/bundle:25:in `<main>'
ezekg commented 3 weeks ago

Thanks for the report. PRs are welcome here. The lockfile also needs to be updated when the Gemfile is changed.

ezekg commented 3 weeks ago

One thing that's been on my list is researching how other apps handle this.