-
Notifications
You must be signed in to change notification settings - Fork 577
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
Support reproducible builds #1250
Comments
Hi, we've investigated this - SOURCE_DATE_EPOCH is a promising direction, and we tried approaches with resetting mtime for everything. Unfortunately, |
got it; i think esp with python it'd be difficult to do with its own toolchains. maybe generating the docker file per #1241 (comment) and then chaining it to off the shelf
i realize now we're involving kaniko as well but it maybe easier to delegate it like this for now |
Would that address the pyc timestamps? |
i think so, as part of the kaniko reproducible builds, it sets up snapshots resetting the all file times. tried it from the getting started guide and using the generated
which doesn't exist and causes the kanilo to fail
|
oh, so python embeds the timestamp inside the file...then kaniko isn't gonna help out. ...and i can't sincerely recommend going all out on and investing in python-bazel builds |
as a stopgap for the debug issue, run cog build once and then interrupt, it will place a cog wheel in .cog/tmp/whatever, and then you can edit the does python-bazel address pyc timestamps somehow? does it just strip pyc files? it would be incredibly helpful for us to get reproducible builds for deduplication |
yeah, i tried the interrupt trick suggested but each cog+kaniko build is different hash (which is expected, i tihnk) i'm unsure exactly how bazel some examples with rules_python which may help answer the question though....once it works with rules_python, stitching it with rules_docker and containers would be easy https://github.com/bazelbuild/rules_python/tree/main/examples |
Y'all might also investigate Nix (which provides Nix converts all timestamps to one second past epoch, btw. |
Does rules_python generate pyc at all? bazelbuild/rules_python#1761 Again, there's no issue with mtimes, the problem is the timestamps embedded in pyc files |
The NixOS install CD is fully binary reproducible. I can't imagine it not including Python, so clearly they've got that licked somehow. Indeed, quoting:
|
then we would have to ship nix's patched interpreter, right? DETERMINISTIC_BUILD is not present in stock python |
her'es an end-to-end covering building an image with bazel and serving with cog. if precise build steps are followed, you should end up with
(i verified it on two different clean vms) as mentioned, using bazel is really tedious though toolchains like gazelle may help with python. [tbh, i've never used or needed cog and try to not use bazel for deterministic builds (in go there are easier ways)...this issue with cog was something i noticed and then ratholed academically.] |
I would like to add my +1 for supporting reproducible builds via Nix and NixOS as well. |
https://github.com/datakami/cognix is a project that exists and kind of works but unfortunately isn't a priority for us at this time |
Cog currently uses docker to build the images
however, docker based builds are not reproducible: you'll get different image hashes even with the identical config
this long-term feature request is to refactor the build system from docker to something like
buildah
bazel
some references building using kaniko and bazel
The text was updated successfully, but these errors were encountered: