351 Commits

Author SHA1 Message Date
CrazyMax
86ddfea28e filesync: detect local export multi-platform transfer support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-11 18:53:07 +02:00
CrazyMax
73c67671d3 exporter: use root-backed fsutil receive instead of client-side staging
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-10 12:24:31 +02:00
CrazyMax
00764d4f69 exporter: add local exporter mode=delete
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-10 12:13:15 +02:00
Tonis Tiigi
e9ed800105 exporter: default docker tar to OCI types
Apply the oci-mediatypes default at export time so the Docker tar exporter
does not treat variant=docker as implicit oci-mediatypes=false.

Keep Docker tar manifest.json output for legacy compatibility, and preserve
explicit oci-mediatypes=false behavior with test coverage.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-08 22:20:08 -07:00
Tõnis Tiigi
2ff20da8b4 Merge pull request #6824 from tonistiigi/oci-mediatypes
exporter/containerimage: default to oci-mediatypes=true
2026-06-04 08:45:50 -07:00
Tonis Tiigi
6147354ae5 exporter: add compatibility version 30
Add compatibility-version 30 for the new OCI media type default while keeping
version 20 pinned to the historical image exporter behavior through v0.31.x.

Track omitted oci-mediatypes separately from explicit false, add v30
compatibility goldens, and document the supported compatibility versions.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-03 08:52:37 -07:00
Tonis Tiigi
c4ce866e0f exporter: fix OCI media type test coverage
Allow annotation and attestation exports with OCI media types enabled, fix
the zstd media type map, and update integration tests for the new default.
Keep Docker media types explicit where legacy behavior is under test.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-03 08:52:31 -07:00
Bjorn Neergaard
7e5cf25bde exporter/containerimage: document "oci-artifact=" values
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:12 -07:00
Bjorn Neergaard
54547ec0b1 exporter/containerimage: parse oci-mediatypes=bool strictly
This matches the documentation, which never specified behavior for
empty/unknown (non-boolean) strings.

We can also remove the parseBoolWithDefault helper, as this was the last
consumer.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:12 -07:00
Bjorn Neergaard
d4ebc6d55b exporter/containerimage: remove unnecessary errors.Errorf
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:12 -07:00
Bjorn Neergaard
9144af6feb exporter/containerimage: default to oci-mediatype=true
To facilitate this change, we now fail when there is an exporter option
conflict instead of implicitly setting oci-mediatypes=true.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:12 -07:00
Bjorn Neergaard
4485d304c7 exporter/containerimage: remove unused EnableForceCompression
This helper has not been used for some time.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:11 -07:00
Tonis Tiigi
f21f35fad0 attestation: emit in-toto v1 statements directly
Use the existing in-toto-golang JSON statement types for attestation export
and set the statement type URI to in-toto v1. Remove the local protojson
compatibility wrapper so this patch only changes the emitted statement type.

Update in-toto-golang to v0.11.0 and refresh vendored module metadata.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-02 23:09:19 -07:00
CrazyMax
284e944657 attestation: switch exporter paths to in-toto v1 json wrapper
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-02 23:04:19 -07:00
CrazyMax
faffd6c4df attestation: add in-toto v1 json compatibility wrapper
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-02 23:04:17 -07:00
Tonis Tiigi
23f04e103e exporter: close local export progress writer
Ensure the local exporter closes the progress writer after copying files so
progress readers are released when the transfer exits before a final callback.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-05-29 18:20:54 -07:00
Tonis Tiigi
98e1113c6d lint: modernize Go lint findings
Update non-generated code for the newer lint recommendations by using typed
atomic values, strings.Cut, and slices.Backward where applicable.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-05-14 10:13:21 -07:00
Tõnis Tiigi
c1b5264bfd Merge pull request #6681 from tonistiigi/compat-version
solver: add compatibility-version support
2026-04-27 14:21:38 +02:00
Tonis Tiigi
5fde446dee solver: add compatibility-version support
Add solve-wide compatibility-version support for image and oci
exports, with historical goldens and release compatibility tests.

Backfill version 10 for v0.13-v0.14 git artifact behavior, keep
version 20 as current, and reject unsupported zstd on v10.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-04-10 09:24:11 -07:00
Tonis Tiigi
4e1c8acd57 dockerfile: support SOURCE_DATE_EPOCH=context
Resolve SOURCE_DATE_EPOCH=context in the Dockerfile frontend from the
main build context and pass the resolved numeric epoch through normal
ARG handling and exporter metadata.

Use git commit time for git contexts, HTTP Last-Modified when present,
and newest archive entry mtime for HTTP archives. Leave local contexts
unset.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-04-08 15:27:20 -07:00
Tonis Tiigi
9b56be75f3 exporter: propagate Dockerfile default epoch
Propagate Dockerfile-defined SOURCE_DATE_EPOCH through frontend result
metadata so exporters can consume it, including per-platform export
paths and rewrite-timestamp handling.

Refactor Dockerfile2LLB to return a structured result, preserve exporter
reset semantics, and cover the exporter-facing behavior with Dockerfile
integration tests.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-23 22:16:46 -07:00
Tonis Tiigi
7cb764d22f exporter: fix snapshot GC race during image unpack
Use ApplyLayers instead of per-layer ApplyLayer loop to
allow recursive parent rebuild when GC collects a parent
snapshot between Stat and Prepare calls.

Pre-lease the top chain ID snapshot before calling
ApplyLayers so that GC cannot collect it during the Stat
shortcut path which does not add snapshots to the lease.

Fixes #6521

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-05 16:22:20 -08:00
Tonis Tiigi
8349e9cd7c containerimage: fix possible race on parallel image create
When image was (externally or in parallel build request) created
in between Update and Create calls, Create can fail.

Handle this case by running Update again.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-05 15:39:13 -08:00
Amr Mahdi
88ef66c6b3 solver: run image and cache exports in parallel
Split image export into two phases to enable parallel execution:
1. Export creates artifacts (layers, manifests) in the content store
2. FinalizeFunc pushes artifacts to the registry

This allows image push to run in parallel with cache export, reducing
overall build time when both image and cache exports are configured.

The cache exporters run after image Export completes, ensuring they can
see and reuse the layers in the content store.

Signed-off-by: Amr Mahdi <amrmahdi@meta.com>
2026-02-04 18:21:35 -08:00
Tonis Tiigi
55ac82cb58 hack: update gopls to v0.38.0
Currently it is not possible to update to more
recent version as modernize causes errors in generated code.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-13 22:09:25 -08:00
Tonis Tiigi
8d666d1872 exporter: expose build ref to the exporter as part of buildinfo
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-12-16 09:31:08 -08:00
CrazyMax
d31230ea96 lint: gopls fixes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-09-09 14:13:04 +02:00
CrazyMax
29deb6a492 fix subject for oci artifact of attestation manifest
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-09-06 17:50:23 +02:00
Alberto Garcia Hierro
d84b119daf fix: display error details on unexpected response status code errors
When receiving a remote error due to an unexpected status code, read the
body and try to decode either a docker.Error or a simpler {"details"...}
payload. If those succeed, decode and format them appropriately. Otherwise,
fallback to displaying the raw response body which might contain valuable
information to indicate why authentication failed.

Signed-off-by: Alberto Garcia Hierro <damaso.hierro@docker.com>
2025-07-14 19:37:50 +01:00
CrazyMax
3a4179cf42 local: fix attestation filename
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-25 18:14:01 +02:00
Anthony Nandaa
40ddcfca90 fix: wcow: privileges for local exporter
Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2025-06-11 17:35:06 +02:00
Tonis Tiigi
41ee238815 local: fix platform-split=true option
Currently the option only worked when platform-split=false was
set for multi-platform build but not for setting single platform
build to use platform-split=true.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-06-11 11:33:14 +02:00
Tonis Tiigi
d5704f85f4 exporter: fix oci export of multi-platform nil result
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-27 22:08:19 -07:00
Tõnis Tiigi
72950ab28c Merge pull request #5958 from tonistiigi/pusher-response-error
pusher: add response details to push errors
2025-05-13 14:21:37 -07:00
Tõnis Tiigi
5666820e70 Merge pull request #5895 from profnandaa/fix-default-windows-path
windows: leave default PATH env to be set by the OS
2025-05-13 09:19:27 -07:00
Anthony Nandaa
14acf4c23d wcow: leave default PATH env to be set by the OS
The PATH is very critical during container runs on
Windows. Windows stores the PATH details in its
registry hive, while in unix, this is often
stored in the image's config. See further details
at #5445

Setting a default path like we do on Linux
(which is mostly not used since the PATH is
already set in the configs), works against
the expected build experience, especially when
it comes to installers and commands like `setx`.

Therefore, we skip setting the default PATH on
Windows, and leave it for the OS to load it
from its registry hive.

This also further supports backward compatibilitiy
with the current experience with docker classic
builder.

Users wishing to explicitly store this in the
configs can opt-in by using the ENV PATH= ..
in the Dockerfile, etc.

See also the same practices on Docker Engine
and Containerd:
- da3b31fb2c/oci/defaults.go (L24-L33)
- 041743e8af/pkg/oci/spec_opts_windows.go (L66-L69)

closes #5445

Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2025-05-10 18:51:38 +03:00
Tonis Tiigi
9fcedf9807 update gopls to go1.24 compatible version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-07 18:23:20 -07:00
Tonis Tiigi
0a4873dd64 pusher: add response details to push errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-05 17:44:43 -07:00
Tonis Tiigi
1e512a15c3 lint: add fatcontext
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-02 12:19:22 -07:00
Tonis Tiigi
f1f56c2b77 golangci-lint: v2 upgrade
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-02 12:19:17 -07:00
Tõnis Tiigi
37daea90eb Merge pull request #5863 from tonistiigi/sort-update
lint: update some sorting code to newer generics based libs
2025-04-09 09:38:30 -07:00
Jonathan A. Sternberg
66016a8c63 vendor: switch from idtools to moby/sys/user
Convert usages of `github.com/docker/docker/pkg/idtools` to
`github.com/moby/sys/user` in order to break the dependency between
buildkit and docker.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-02 10:22:02 -05:00
Tõnis Tiigi
bdc7a96470 Merge pull request #5858 from jsternberg/moby-dangling-force
containerimage: container image exporter creates dangling images by default
2025-03-21 09:21:22 -07:00
Jonathan A. Sternberg
41a394e9cd containerimage: container image exporter creates dangling images by default
Modifies the containerd exporter to create dangling images by default. A
new exporter key has been added to keep the previous behavior where a
dangling image is only created when no image name is provided.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-03-21 10:40:35 -05:00
Tonis Tiigi
f6c142ec23 lint: update some sorting code to newer generics based libs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-03-20 10:32:02 -07:00
Jonathan A. Sternberg
03bab826e3 exporter: expose image.name constant for the exported image name
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-03-20 09:21:28 -05:00
Tonis Tiigi
b5286f8dcb apply x/tools/modernize fixes
Autogenerated with couple of manual patches.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-03-07 08:18:45 -08:00
Anthony Nandaa
cc0cb08936 refactor: avoid unnecessary calls to platforms.DefaultSpec()
I came across a number of calls to `platforms.DefaultSpec()`
that were not necessary. That prompted me to take a look
various other similar places.

At least on Windows, the call is a has some cost till
doing a sycall `RtlGetNtVersionNumbers()`.

Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2025-02-19 07:36:36 +03:00
Jonathan A. Sternberg
14d407b1ab verifier: do not run invalid platforms check when there are no results
When `--call=lint` or `--call=outline` were used, the intention wasn't
to run this check because the result doesn't have a platform. When those
checks are run, there is no exporter platforms key.

We would check `Request` from the request operations, but this wasn't a
reliable way to determine whether the result was from a lint because it
is possible for subrequests to have different frontend attributes than
the primary request and the primary request would sometimes not have the
`requestid` attribute set.

Instead of detecting a subrequest with that method, the check has been
updated to exit if there are no references and if there is no exporter
key.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-02-12 14:07:14 -06:00
Brian Goff
94ddeb7dbe Support OS version in platform string
This allows platforms following the new `platforms.FormatAll` function,
which allows for setting the `OSVersion` field of the platform with
`<os>(<ver>)/<arch>`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2025-01-14 09:27:19 -08:00