-
Notifications
You must be signed in to change notification settings - Fork 45
Fix the container to contain predictable non-overlapping dependencies from different ecosystems #18
Comments
How about installing using --user? Also, I am not convinced that breakage will happen until I will see a real bug report, preferably for one crated just to demonstrate that it is possible to happen. If we automate the rpm packaging we could switch to use of rpms only BUT where is the latest ansible-core rpm? How often is that updated? Keep in mind that creator-ee is upstream, so it is expected to be less stable than an official AAP execution environment, which will likely be build on RHEL and use only rpms. So, even if it breaks, you could say that is "by design". I would prefer to do something about this when the need is real. |
This would be better than it is now. But it'd still leave the room for breaking stuff. Especially as people start inheriting the image, requesting things of certain versions to be installed by dnf (via extra collection requirements, for example) and having dnf responding with "skipping, that's already installed". The more collections+other transitive dependencies get added, the more misleading metadata this generates. At some point, there will be dependencies that differ from what some of the collections expect. Sometimes those differences will be slight and undetectable (while still being important), other times they will cause problems at runtime. Thinking about this more, I'm pretty sure that
The original post demonstrates exactly that.
That's beside the point. We shouldn't produce broken environments, period. |
There are at least two issues here:
The first case deals with The second case deals with conflicts that occur when requirements are defined by multiple independent projects in the same Python environment. Use separate virtual environments for each project when feasible. Otherwise, make sure all Python requirements in a single environment are evaluated together to detect conflicts. |
@mattclay In the absence of an automatic process for producing rpms for all our dependencies for the current base distribution using pip will continue to prefered. I am personally against using virtualenvs inside containers, for multiple reasons and one of them being that we want to use at least some system packages. Slowly we could change the way we use pip to force it to skip installing dependencies and having us manually install them using dnf. At the end we can check for presence of conflicts and fail the build if we find any. If done right the only packages installed with pip will be out own ones and in the longer term, we could also start installing these as RPMs once we have an rpm repository for our ansible tools. Still considering that even ansible-core does not publish an rpm for centos-stream automatically on new releases I am inclined to believe we will not see this soon and continue to install using pip. AFAIK, the purpose of creator-ee is to ensure we test the bleeding edge and fail-fast when needed. That project should not be seen a a production level execution environment, which would have a different update and testing policy, where I fully support a pure rpm approach. Another reason for keeping use of pip is the fact that dependabot does not support updating system packages. So, we cannot really produce a pinned list of dependencies and automate testing of updates when newer versions appear. With current setup, [](https://github.com/ansible/creator-ee/blob/main/_build/requirements.txt) acts as built manifest and when a new dependency makes a new release we get a pull-request to update it, one that can assert if the change has a negative impact or not. The reality is that I expect that lost of users of |
@webknjaz Being back at your original problem related to cryptography. We can change the way we install with pip to something like That should install only the top level deps from pip and fail if we miss real dependencies from system or if the system ones are outdated. We will need to include a short list of deps that are not packaged as rpms into |
@ssbarnea I think that having a venv with system site-packages is a good start but FWIW I don't mean that we should be solving all of these problems in this repository. It's probably best to solve this on the For now, let's do your suggestion here but also track this problem with |
I think with the latest changes, this looks like it's solved now. Or am I wrong? |
Sadly the situation is only improved and not fixed. We will need some changes in ansible-builder in order to fix it, like an option to pass |
requirements.txt
in this repository requestscryptography==36.0.1
managed by pip butrequirements.yml
pulls inopenstack.cloud
which in turn haspython38-cryptography
package managed by dnf. Both installers fight for the control over the system-wide site-packages folder.If we look into the log at https://github.com/ansible/creator-ee/pull/12/checks#step:6:1013 and earlier, we'll notice this pattern:
dnf installs cryptography v2.8 (as needed by the
openstack.cloud
collection)Installing : python38-cryptography-2.8-3.module_el8.5.0+742+dba 38/45
pip installs cryptography v36.0.1 as requested by this project's direct requirements in the exact same location on disk:
(dnf keeps thinking that v2.8 is still installed and pip rightfully warns us that something sketchy is happening)
The build process goes on and attempts to install some more packages via dnf. Some of them are installed already (at least that's what dnf thinks):
The truth is that the statement about
python38-cryptography-2.8
is a lie. A package with this name exists on disk but its version is different.While the software that we invoke may hot be crashing, there are some things in the system that may depend on those system-provided versions that are no longer in place. For example, if some Ansible collection requires the use of an older
cryptography
API, then we would only hit that case (potentially) in runtime. But there is no guarantee that it would crash the program somehow. That API may have different defaults which would only influence some of the protocol-level behavior — everything will appear to work, except for having a security issue, for example.Another problem with this is that the OS-packaged software is usually expected to be dynamically linked against system (often cryptographically significant) libraries that can be updated separately when mitigating vulnerabilities. While the pip-installed wheels bundle those libraries by linking them statically. This means that there is another expectation that is broken.
It should be possible to fix this by using a virtualenv which is the best practice when it comes to isolating the application dependencies that are managed by pip from the interpreter-global installation.
The text was updated successfully, but these errors were encountered: