-
Notifications
You must be signed in to change notification settings - Fork 694
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
Python 3.9 generating different image digests #1680
Comments
If I'm understanding your issue correctly, the digest is different because the Python interpreter is changing, therefore the Python interpreter must be an input to your image somehow. The digester tool itself does not use the Python interpreter (the digest producing tool is Golang: If your containers are not layering in
I think we'd have to know why the Python interpreter is becoming an input into the digest. |
Sorry, I should have been clearer in the issue description. The issue here is not the digester, it's the inputs into the digester iiuc. I've generated an image with Python 3.8 and 3.9 and get different
The image in this case contains a Go binary, which has the same hash in both layers. I'm not sure what other information would be helpful, so please let me know what you need.
Yes, absolutely, but having a hermetic Python setup is hard 😄 There's no real option apart from building it yourself, and depending on MacOS version there's no one-size-fits-all command to do so. For us, that would have been way harder than just to tell people to use / install 3.8 :-) |
So if you run a command like:
You get one file in Given my limited knowledge of tar files, that would differences in the headers contained in the tar file. Which would be strange. |
Yes, exactly. I've created a minimal example of this issue here. I think I saw something similar with the tar headers in another issue, but I was unable to find it again. Something which changed between a minor Python version and had to be hardcoded in the rules... that feels similar. |
This is because python/cpython#18080 [apparently] hasn't been back-ported to python3.8, and that library is used by rules_docker/container/archive.py Line 144 in bdea234
So the tar headers end up slightly different (different devmajor, devminor, and as a consequence different header checksum value), which explains a different sha256sum. |
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. |
Judging from the underlying „issue“ as described above, I don‘t assume that this issue as described is fixable, really. a built-in python toolchain would fix this by making it easier to depend on a single python version even in different dev environments. Either way, I‘ll go ahead and close this issue. Thanks everyone that helped looking at this! |
We're currently facing a bug with users having newer installations of Python (3.9).
We are depending on the reproducibility of Container Images and Digests, and image builds on different OS & Platforms should always result in the same image digest (note that we're always building images for linux / amd64).
However, we started noticing an issue with people that upgraded their Python 3 version to 3.9.
The digests seem to differ to older versions.
We noticed this on two different systems:
On MacOS, the system installations of python (
/usr/bin
) are old enough, for example on Big Sur, python3 is 3.8.2. However, the user may install newer Python versions with brew, which makes thepython
binary to be 3.9 instead of the system's one.In this case,
/usr/bin/python3
is the system-installation, butpython3
selected from the user's$PATH
is / may be brew's installation of python 3.9.On Linux, where the user just had upgraded their python version.
We mitigated this issue, at least for MacOS, by registering custom toolchains:
On Linux, we require the user to install a python version pre-3.9 and link it to
/usr/bin/python3
.There is an issue in
rules_python
to register the python interpreter similarly to howgo_register_toolchain
downloads the correct version of the Go compiler; making the build independent of the Host. While this would fix the issue at hand, it would still only be a workaround too.Is this a bug in
rules_docker
that the image digests differ with newer versions of python, or is this just an issue from Python itself?The text was updated successfully, but these errors were encountered: