[all] Cargo Culted Tox install_command overrides
A subset of tempest jobs recently began to exhibit some interesting behavior. The tox installation was finding the global pip installation instead of pip in the tox virtualenv which led to an attempt to install packages globally which failed. Eventually, I discovered the reason this happened was that virtualenv created a broken venv installation for tox, but this was made far more confusing by two tox settings in tempest's tox.ini: install_command and allowlist_externals. Tempest had overridden install_command to ` pip install {opts} {packages}` and set allowlist_externals to `*`. This allowed tox to find and use global pip without complaint. Tempest has since cleaned these up with this change [0], which should result in nicer error messages in the future if we have similar problems. I have noticed that many projects have cargo culted this configuration, particularly for install_command [1]. The default install_command for tox is `python -m pip install {opts} {packages}` [2]. This is almost equivalent to our overrides except that it uses pip as a module. This is important in this case because we don't install python2 regularly which means there is no `python` command except for in the created virtualenv where `python` == `python3`. The resulting behavior difference here would have been helpful to have when debugging the underlying issue in tempest. All that to say, I would suggest that those who have install_command set similarly to tempest remove this unnecessary configuration. Separately, setting allowlist_externals to `*` allows all global commands to run without complaint or an indication they are being used. Far fewer projects have this problem though [3]. Those that do should consider updating their config to explicitly list the commands they actually need from outside the virtualenv. Neither of these changes is critical, but I wanted people to be aware of this as we seem to have copied it all over the place. [0] https://review.opendev.org/c/openstack/tempest/+/865314 [1] https://codesearch.opendev.org/?q=install_command&i=nope&literal=nope&files=tox.ini&excludeFiles=&repos= [2] https://tox.wiki/en/latest/config.html#conf-install_command [3] https://codesearch.opendev.org/?q=allowlist_externals%20%3D%20%5C*&i=nope&literal=nope&files=tox.ini&excludeFiles=&repos=
participants (1)
-
Clark Boylan