Skip to content
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

Set rewrite-timestamp=true #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AkihiroSuda
Copy link

Part of:

This exporter option rewrites the timestamps of the files inside image layers to use $SOURCE_DATE_EPOCH so as to increase reproducibility.

https://github.com/moby/buildkit/blob/v0.15.2/docs/build-repro.md#source_date_epoch

@tianon
Copy link
Member

tianon commented Aug 19, 2024

moby/buildkit#4576 (comment)

Regarding enabling rewrite-timestamp=true, are there any side effects? In other words, why is the behavior opt-in instead of opt-out or even just enabled by default and/or automatically enabled when an appropriate SOURCE_DATE_EPOCH is set? What are the downsides, and how do we communicate them to our users when they ask us about the metadata of the images we publish? (Which is a thing that's already surprised quite a few people in our images since we've started setting SOURCE_DATE_EPOCH and the timestamps on the metadata of layers of an image were no longer necessarily always linear, which is technically correct, but also surprising behavior, especially after ~10 years of that not being the way this works.)

You replied that it's incompatible with unpack=true - should I know what unpack is for? Having to enable this by default if it's generally sane, reasonable, and safe still feels really backwards/wrong and makes me question whether it really is generally sane, reasonable, and safe.

@AkihiroSuda
Copy link
Author

unpack=true means unpacking image blobs as containerd snapshots.
I'll try to implement the support for unpack=true, but it does not relate to docker-library/meta-scripts.

@AkihiroSuda
Copy link
Author

ping?

Part of docker-library/official-images issue 16044

This exporter option rewrites the timestamps of the files inside image layers
to use $SOURCE_DATE_EPOCH so as to increase reproducibility.

https://github.com/moby/buildkit/blob/v0.15.2/docs/build-repro.md#source_date_epoch

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda
Copy link
Author

Rebased

@thompson-shaun
Copy link

thompson-shaun commented Oct 25, 2024

👋 @AkihiroSuda - For this PR specifically what are we seeing as the user benefit? Also, what is the risk to existing users? Are there downstream tools that would be angry?

The bigger context being in docker-library/official-images#16044 of course 😄

@AkihiroSuda
Copy link
Author

For this PR specifically what are we seeing as the user benefit?

The benefit is the reduction of the diff across builds.
This will help evaluating the potential risk of supply chain attacks.

Note that this rewrite-timestamp=true PR only affects the timestamps, and does not affect the file contents.

For reproducing the file contents, the following Dockerfile PRs are still needed:

No additional PR is needed for the following repos:

Also, what is the risk to existing users?

A build may take an additional couple of minutes for rewriting the timestamps.

Are there downstream tools that would be angry?

https://github.com/reproducible-containers/diffoci is "angry" by default for timestamp differences, though it has --ignore-timestamps flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants