Skip to content

Commit 8514c30

Browse files
committed
Set rewrite-timestamp=true
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]>
1 parent 762cadb commit 8514c30

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.test/meta-commands/out.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
SOURCE_DATE_EPOCH=1700741054 \
77
docker buildx build --progress=plain \
88
--provenance=mode=max,builder-id='https://github.com/docker-library' \
9-
--output '"type=oci","dest=temp.tar"' \
9+
--output '"type=oci","dest=temp.tar","rewrite-timestamp=true"' \
1010
--annotation 'org.opencontainers.image.source=https://github.com/docker-library/docker.git#6d541d27b5dd12639e5a33a675ebca04d3837d74:24/cli' \
1111
--annotation 'org.opencontainers.image.revision=6d541d27b5dd12639e5a33a675ebca04d3837d74' \
1212
--annotation 'org.opencontainers.image.created=2023-11-23T12:04:14Z' \
@@ -145,7 +145,7 @@ SOURCE_DATE_EPOCH=1709081058 \
145145
--provenance=false \
146146
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=all \
147147
--sbom=generator="$BASHBREW_BUILDKIT_SBOM_GENERATOR" \
148-
--output 'type=oci,tar=false,dest=sbom' \
148+
--output 'type=oci,tar=false,dest=sbom,rewrite-timestamp=true' \
149149
--platform 'linux/amd64' \
150150
--build-context "fake=oci-layout://$PWD/temp@$originalImageManifest" \
151151
- <<<'FROM fake'

meta.jq

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def build_command:
149149
[
150150
"type=oci",
151151
"dest=temp.tar", # TODO choose/find a good "safe" place to put this (temporarily)
152+
"rewrite-timestamp=true",
152153
empty
153154
]
154155
| @csv
@@ -329,7 +330,7 @@ def build_command:
329330
"--load=false", "--provenance=false", # explicitly disable a few features we want to avoid
330331
"--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=all", # disable linting (https://github.com/moby/buildkit/pull/4962)
331332
"--sbom=generator=\"$BASHBREW_BUILDKIT_SBOM_GENERATOR\"",
332-
"--output 'type=oci,tar=false,dest=sbom'",
333+
"--output 'type=oci,tar=false,dest=sbom,rewrite-timestamp=true'",
333334
# TODO also add appropriate "--tag" lines (which would give us a mostly correct "subject" block in the generated SBOM, but we'd then need to replace instances of ${sbomImageManifest#*:} with ${originalImageManifest#*:} for their values to be correct)
334335
@sh "--platform \(.source.arches[.build.arch].platformString)",
335336
"--build-context \"fake=oci-layout://$PWD/temp@$originalImageManifest\"",

0 commit comments

Comments
 (0)