New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace deprecated Bundler.with_clean_env
with with_unbundled_env
#2120
Replace deprecated Bundler.with_clean_env
with with_unbundled_env
#2120
Conversation
bb06b8b
to
a189b7f
Compare
a189b7f
to
d30d837
Compare
I don't see new checks, and I don't understand |
d30d837
to
563bdd5
Compare
I don't understand why Ruby 2.2 fails, the job doesn't look like mentioned problem. |
@@ -296,11 +296,7 @@ def prune_bundler | |||
deps, dirs = dependencies_and_files_to_require_after_prune | |||
|
|||
log '* Pruning Bundler environment' | |||
home = ENV['GEM_HOME'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought original_env only looked at BUNDLE_
environment variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any test for this? Or can we write it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#653 looks like no test exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to implement tests for this, but if somebody can help me — I appreciate it, I'm not too familiar with Puma sources and environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there are no tests for #1893. And I've found prune_bundler
in test/
directory only in test/config/prune_bundler_with_deps.rb
, and I see no usage of this file in test/
.
I've added p ENV['GEM_HOME']
inside Launcher#prune_bundler
and there is no output from tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I've found test/test_preserve_bundler_env.rb
, OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't see that output because the Puma tests create new processes whose output is not piped to STDOUT. Take a look at the helpers/integration test code for more info.
The test for #1893 is here: https://github.com/puma/puma/pull/1893/files#diff-1a1a7e313ee72a0ca0e8eb22a2524879
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the helpers/integration test code for more info.
I've found :log
option for wait_for_server_to_boot
, yes, thank you.
Current results:
GEM_HOME
was/home/alex/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0
and becomesnil
BUNDLE_GEMFILE
was/home/alex/Projects/ruby/puma/test/bundle_preservation_test/Gemfile.bundle_env_preservation_test
and becomesGemfile.bundle_env_preservation_test
.
I'll try to add correct test for GEM_HOME
. I think the change of BUNDLE_GEMFILE
is not critical (tests are passing).
Questions/concerns:
|
563bdd5
to
9fe396c
Compare
But tests are somewhy failing without manual reassign at least Oh… it's passing without I think, we can re-do something similar to
Yes, done.
Let's look. Maybe it's not related, due to #2018 |
Bundler.with_clean_env
with with_original_env
Bundler.with_clean_env
with with_unbundled_env
Bundler.with_clean_env
with with_unbundled_env
Bundler.with_clean_env
with with_unbundled_env
9fe396c
to
abf3e42
Compare
Bundler.with_clean_env
with with_unbundled_env
Bundler.with_clean_env
with with_unbundled_env
I've removed "WIP" status because I don't think that we'll get We can patch or work-around private |
OK, I've understood that I'm not completely understand |
Like… when we use |
abf3e42
to
4f1ade1
Compare
Right now we have 100% reproducable case of #2018. 😅 |
Is it? I think this is a different exception class: https://github.com/puma/puma/pull/2120/checks?check_run_id=467555536#step:8:78 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a "review" to clear my request.
Sorry, I just don't know what should I do now. I see problems, but I don't know in which direction I should move. My questions from February 25th are still actual. |
Yikes, I just started running tests with a newer bundler version, and the output from all deprecation notices is so ugly. This just got bumped up a notch on the priority list! |
I'm honestly not sure what to do here, but I think we should be crosstalking with the people in #2133. |
Thank you, I'm involved into discussion. |
5288943
to
54b516e
Compare
I don't know what to do (I hate old versions of software): with (unsupported) Ruby 2.2 this PR is excess:
So… we should use an old version of Bundler for Ruby 2.2, but we should change a code for a new version of Bundler for Ruby 2.7. It seems like two chairs, I suggest to drop Ruby 2.2 support, or at least left this PR open until it'll be happen. |
Also add tests for `GEM_HOME` environment variable preserving. Also drop `BUNDLE_GEMFILE` preserving, resolve puma#2133 Also disable local `path` for `bundle install` in CI, it makes `nio4r` unavailable. Also install (update) `bundler` in CI, old versions are incompatible.
54b516e
to
0669fb5
Compare
@@ -27,9 +30,11 @@ def test_usr2_restart_preserves_bundler_environment | |||
@pid = @server.pid | |||
connection = connect | |||
initial_reply = read_body(connection) | |||
assert_match("Gemfile.bundle_env_preservation_test", initial_reply) | |||
refute_match(bundle_gemfile, initial_reply) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the situation as I understand it:
- Prior to Preserve BUNDLE_GEMFILE and add a test for it #1893, it was not possible to run your app using a non-default Gemfile. Setting
BUNDLE_GEMFILE=Gemfile.rails6
(for example, as a way to test an app using a different version of Rails), would work at first, but as soon as the app was reloaded/restarted, then the environment variable would be reset to default. Preserve BUNDLE_GEMFILE and add a test for it #1893 fixed that, but also introduced a bug: BUNDLE_GEMFILE is incorrectly set to parent Gemfile in worker processes (when not setting BUNDLE_GEMFILE explicitly) #2133. - BUNDLE_GEMFILE is incorrectly set to parent Gemfile in worker processes (when not setting BUNDLE_GEMFILE explicitly) #2133 details the bug where child processes inherit the full path of the Gemfile of the master process. Instead of the child process seeing the value of
BUNDLE_GEMFILE
as simply "Gemfile" or "Gemfile.rails6", the child process gets the full path to the gemfile, after its path has been expanded. That's bad.
If there is a way to have both the value preservation of #1893, but without the full path sharing detailed in #2133, then we'd like to have both.
Whew! I hope that makes sense.
@@ -40,8 +40,11 @@ jobs: | |||
run: | | |||
gem update --system 2.7.10 --no-document | |||
|
|||
- name: Update Bundler | |||
run: gem install bundler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR fails on Ruby 2.2 because you're install Bundler 2 on Ruby 2.2. Instead, you need to change the Github action so that you're running gem install bundler -v 1.17.3
when running Ruby 2.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2.2 Rubies have Bundler 1.7.3 installed already. See the 2.2 jobs at:
https://github.com/ruby/setup-ruby/runs/491284436
Oh I see.
IMO we should scale back this PR to the above and leave out any other changes. |
There are tests… but, as you wish. Thank you for clarification and suggestions. |
Also add tests for
GEM_HOME
environment variable preserving.Rework of #1794
Also drop
BUNDLE_GEMFILE
preserving, resolve #2133Also disable local
path
forbundle install
in CI, it makesnio4r
unavailable.Also install (update)
bundler
in CI, old versions are incompatible.Your checklist for this pull request
[changelog skip]
the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.