Add support for SOURCE_DATE_EPOCH - #2918
Conversation
3e881bb to
c961e63
Compare
eb72e03 to
7f2c1a1
Compare
|
Can you update docs in https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#built-in-build-args for |
|
Can we pass this into the RUN steps without defining an ARG in the Dockerfile? I.e. the same way we do for http proxy today? |
I think defining |
Since the user is running the build command, what if the forced |
|
It would, for example, mean that build-cache does not apply between builds that use epoch and ones that do not, even if the run steps make no use of the added argument. I don't think avoiding changes in Dockerfile is a goal (in fact, we are probably adding #epoch), especially if the behavior of the Dockerfile commands changes. Ultimately it is the Dockerfile author who knows if the process they use in |
7f2c1a1 to
a7bfde9
Compare
| * `BUILDKIT_MULTI_PLATFORM=<bool>` opt into determnistic output regardless of multi-platform output or not | ||
| * `BUILDKIT_SANDBOX_HOSTNAME=<string>` set the hostname (default `buildkitsandbox`) | ||
| * `BUILDKIT_SYNTAX=<image>` set frontend image | ||
| * `SOURCE_DATE_EPOCH` set the UNIX timestamp for created image and layers. More info from [reproducible builds](https://reproducible-builds.org/docs/source-date-epoch/). |
There was a problem hiding this comment.
Probably better to clarify the syntax version (1.5, unreleased)
|
LGTM but a couple of nits. |
e78f77d to
f9dc044
Compare
19907e4 to
0ccc9c7
Compare
|
@AkihiroSuda ok to merge? |
|
needs rebase, PTAL @AkihiroSuda |
|
Looks like this needs a rebase again |
|
OCI exporter needs to be fixed to reset "org.opencontainers.image.created" annotation buildkit/exporter/oci/export.go Line 131 in 092e977 |
|
Is this going to apply as well for whiteout files? |
|
And this timestamp is also non-reproducible buildkit/exporter/containerimage/export.go Lines 246 to 249 in 092e977 |
Needs: |
Allows reproducible timestamps for layer and image timestamps. Implemented as a frontend-opt because in the future same option could be detected by frontend for custom behavior and same value should also apply timestamps for FileOps. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
For daemons that don’t support SOURCE_DATE_EPOCH on the exporter we can use these overrides on the frontend side. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
0ccc9c7 to
3cbee1c
Compare
AkihiroSuda
left a comment
There was a problem hiding this comment.
LGTM, thanks
My comments above can be addressed later
addresses #1058
Allows reproducible timestamps for layer and image timestamps.
Implemented as a frontend-opt because in the future, the same option could be detected by frontend for custom behavior
and the same value should also apply timestamps for FileOps. Definition for
SOURCE_DATE_EPOCHcan be found in https://reproducible-builds.org/docs/source-date-epoch/In local and tar exporter, setting the build-arg sets overwrites the timestamp for the output files.
There is also a secondary implementation inside the Dockerfile frontend. This allows getting reproducible image manifests even on old buildkit, by just defining
#syntaxto point to new Dockerfile image.In Dockerfiles the build-arg can also be exposed to inner processes by defining
ARG SOURCE_DATE_EPOCHinside the stage.This is the first stop toward better reproducible builds support that can be followed up with:
COPY/ADDin Dockerfiles dockerfile: add(ADD|COPY) --timestamp=<RFC3339Nano>#2911 @AkihiroSuda#epoch=. Frontend side of this is already implemented and the frontend can pass the epoch value to the exporter(it can not overwrite the value if it has already been set by the user).--build-arg SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)