rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 1.99k forks source link

Fix sudo specs environment #7665

Closed deivid-rodriguez closed 4 years ago

deivid-rodriguez commented 4 years ago

What was the end-user or developer problem that led to this PR?

The developer problem is that sudo specs are not correctly setting the environment (except for ruby 2.3). The specs are accidentally passing but you can tell that they are running against the system ruby by the warning messages they print.

This causes problems when migrating to github actions. See https://github.com/rubygems/bundler/pull/7660#discussion_r385616844.

Another problem is that the environment is setup manually outside of rake spec:sudo, so there's no easy way of running sudo specs manually if your system does not have the right sudoers configuration.

What is your fix for the problem, implemented in this PR?

My fix is to properly set sudo configuration to preserve the environment so that the correct ruby can be found by sudo specs, and also to move the logic inside rake spec:sudo so that the specs can easily be run manually without side effects.

deivid-rodriguez commented 4 years ago

@hsbt Is it ok if I merge this PR, so you can merge the sudo workflow with the main workflow in #7660?

deivid-rodriguez commented 4 years ago

@bundlerbot r=hsbt

ghost commented 4 years ago

Build succeeded