534 Commits

Author SHA1 Message Date
CrazyMax
409c8da50f exporter: revert attestation manifest push order
This reverts the change from #7012.

Referrer manifests may be pushed before their subject, and the OCI distribution spec requires registries to initially accept a manifest whose subject does not exist yet. Keep BuildKit's default push order aligned with that behavior instead of working around registries that reject this flow.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-08-04 00:03:02 +02:00
CrazyMax
067b18bd03 exporter: fix attestation manifest push order
OCI artifact attestations carry a subject reference to the image manifest.
Push manifests in an order that keeps child manifests before parent indexes
while also pushing any in-stack subject manifest before the attestation
that references it.

Add an integration test variant with a strict registry proxy to cover
registries that reject manifests whose subject doesn't already exist.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-08-03 11:39:07 +02:00
CrazyMax
cc977b306b test: avoid local exporter invalid mode integration hang
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-07-27 15:56:11 +02:00
Alberto Garcia Hierro
30a3c27393 exporter: add session export finalization
Add a FinalizeExport RPC to pass the combined exporter response back to
the session provider after all exports complete. This lets clients run
completion work while the build's gateway references remain available.

Keep the callback optional for compatibility with existing session
exporters. Ignore unsupported finalization, propagate callback failures,
and support providers that only register a finalization callback.

Signed-off-by: Alberto Garcia Hierro <alberto.hierro@docker.com>
2026-07-23 16:46:24 +01:00
Tonis Tiigi
56cf3cc0b5 Revert "exporter: sanitize platform IDs in paths"
This reverts commit 77b65abf49.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-07-07 09:09:47 -07:00
Tonis Tiigi
38f8536ee3 client: split client integration tests by area
Move client integration test declarations out of the large harness files into
focused files for cache, exporters, sources, mounts, gateway behavior, and
related client features.

Keep registration lists grouped by source file, move non-gateway tests out of
the gateway harness, and remove the now-empty build_test.go. This is intended
as a mechanical split with no test logic changes.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-07-06 22:19:20 -07:00
Tõnis Tiigi
c130a532e6 Merge pull request #6910 from tonistiigi/platforms-id-sanitize
exporter: sanitize platform IDs in paths
2026-07-06 15:27:00 -07:00
Tonis Tiigi
77b65abf49 exporter: sanitize platform IDs in paths
Replace Windows path separators and drive separators when platform IDs are
used as local and tar exporter path components. Add a regression test for tar
exporter output generated from frontend-controlled platform metadata.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-07-02 17:24:55 -07:00
CrazyMax
9a16a73a42 exporter: default attestations to OCI artifacts
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-30 18:35:50 +02:00
Tonis Tiigi
64bbec89ca security: validate exec security modes
Reject unknown SecurityMode values before generating executor specs. Ensure
only SecurityMode_INSECURE takes the insecure path, while validated non-insecure
modes keep sandbox security options. Add gateway, raw LLB, and LLB marshal
regression coverage for invalid enum values.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 972895718f963c71388aeebb7cff423ef6963a92)
2026-06-24 10:56:46 -07:00
Tonis Tiigi
e45a92397c client: update dockerd test conditions after oci-mediatypes default
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 10:58:45 -07:00
Tonis Tiigi
fc53e5e9d0 client: fix mergeop requirements in new test for dockerd
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 10:58:45 -07:00
Tonis Tiigi
cd33910d58 network: fix proxy default egress
Use the worker default provider for proxy UNSET egress so host fallback
is preserved when no CNI config is configured.

Extend proxy integration coverage across default, host, bridge, and
default-no-cni worker network modes.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 08:33:16 -07: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
Tonis Tiigi
57649e9d9a client: add testExportLocalModeMultiPlatformKeepsAllPlatforms test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 12:13:15 +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
91cc422d5f network: split exec proxy from net mode
Keep exec network modes limited to sandbox, host, and none, and pass proxy
network configuration separately through solve and executor runtime state.

Proxy execs now use bridge-style egress by default, host egress only for host
network mode with entitlement, and no proxy for none mode. Add integration
coverage for bridge, host, and none proxy behavior across OCI and containerd
workers.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-09 09:11:33 -07: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
Tonis Tiigi
c15eb2679f llb: add passthrough op
Add a passthrough LLB op that builds all inputs and exposes selected
inputs as outputs. Add State.Requires as a client shortcut for requiring
dependencies without returning their snapshots.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-08 11:26:15 -07:00
Tonis Tiigi
3254832159 solver: add proxy network mode
Add a build request option that rewrites default exec networking to an
internal proxy network while preserving explicit none networking.

Route HTTP and HTTPS traffic through a BuildKit-owned proxy namespace, enforce
source policy checks for proxied requests, and inject a temporary CA into Linux
rootfs trust bundles for HTTPS interception.

Share namespace pooling between CNI and proxy providers, and cover proxy mode
with unit and integration tests.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-04 11:23:00 -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
a3661ca077 test: avoid local source differ release race
Wait before the second solve so previous local source refs can be released
before the reuse assertion runs.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-03 13:45:01 -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
CrazyMax
ed3dbc0390 Merge pull request #6823 from tonistiigi/intoto-simplified
attestation: migrate emitted in-toto statements to v1
2026-06-03 17:43:08 +02:00
Tõnis Tiigi
174f4f07dd Merge pull request #6760 from crazy-max/session-empty-fallback
resolver: allow anonymous auth while preserving local image fallback
2026-06-03 08:40:56 -07:00
Bjorn Neergaard
c9f1690554 all: use well-known zstd mediaType constants
When support for zstd was introduced, these mediaTypes were not yet
available in released versions of their respective Go packages. That is
no longer the case.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2026-06-02 23:11:12 -07:00
CrazyMax
bb7ed5c529 attestation: update tests and docs for in-toto v1 statements
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-02 23:04:19 -07:00
Tõnis Tiigi
fbb261b445 Merge pull request #6791 from tonistiigi/fix-http-sigsegv
http: fix resolver cache nil race
2026-06-02 11:22:50 -07:00
Tonis Tiigi
fa1ba86389 source/http: fix resolver cache ref lookup
Use the resolver-cache ref ID directly when loading a cached HTTP snapshot.
This avoids dereferencing missing metadata for cache entries found during a
concurrent solve.

Reset the unauthorized checksum race request counter per solve iteration so
each retry applies the intended first-request delay.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-01 21:12:23 -07:00
Tonis Tiigi
9721df1d32 solver: fix slow cache error result ownership
Clone the existing slow-cache input result when wrapping errors instead of
creating a separate shared owner. This keeps SlowCacheError.Result tied to
the same release chain and avoids releasing the input while the error still
holds it.

Update the containerd cleanup check to ignore empty leases while still
failing on leases that retain resources, and add a deterministic regression.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-01 13:50:57 -07:00
CrazyMax
ca9bcf049c containerimage: preserve local fallback for default image resolution
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-05-29 17:17:04 +02:00
Jiří Moravčík
f85c740c2b solver: add per-step CPU and memory resource limits
Add support for setting cgroup resource limits (memory, memory-swap,
cpu-shares, cpu-period, cpu-quota, cpuset-cpus, cpuset-mems) on
individual build steps.

Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
2026-05-27 11:34:13 +02:00
Tonis Tiigi
10872e1722 http: fix resolver cache nil race
Avoid storing typed nil HTTP metadata in the resolver cache after failed
metadata resolution. Also make resolver cache release functions consistently
callable when no error is returned.

Add a client integration test covering concurrent same-URL HTTP sources with
and without checksum when the server returns 401.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-05-20 12:48:07 -07:00
Tõnis Tiigi
550cf8b8b7 Merge pull request #6774 from tonistiigi/0513-dev-tools-updates
dev tools updates
2026-05-14 17:37:14 -07:00
Tonis Tiigi
bd3608ddc9 lint: update golangci-lint to v2.12.2
Update golangci-lint and adjust code for new gosec diagnostics. Use
root-scoped filesystem operations where appropriate, preserve explicit
user path behavior for SSH keys, and avoid background contexts in
request-scoped cleanup paths.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-05-14 10:13:15 -07:00
Tõnis Tiigi
b115ef50da Merge pull request #6612 from jirimoravcik/feat-add-local-cache-reset
client: add `reset` option for local cache exporter
2026-05-13 17:19:40 -07:00
CrazyMax
999e393a01 test: gate merge diff tests through worker capabilities
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-05-13 11:24:14 +02:00
Jiří Moravčík
d14a00065f client: add reset option for local cache exporter
Add `reset=true` attribute to the local cache exporter that removes
unreferenced blobs from the cache directory after export, preventing
unbounded growth.

Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
2026-05-07 23:06:26 +02:00
Tonis Tiigi
9a0c5cb021 git: add git bundle source support
Support importing git sources from OCI or registry-backed bundle blobs
and exporting resolved checkouts as single-file git bundles.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-04-27 14:30:11 +02:00
Natnael Gebremariam
cce6f3e1ad Updated Test Coverage for addgit
Signed-off-by: Natnael Gebremariam <ngebremariam@microsoft.com>
2026-04-20 16:50:52 -07:00
Tõnis Tiigi
a8a4b0f4fe Merge pull request #6649 from tonistiigi/session-monitor-cancel
session: fail stuck session RPCs on health timeout
2026-04-15 09:51:31 -07:00
Jonathan A. Sternberg
22ba88969e chore: remove deprecated client.SolveOpts.LocalDirs member
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-04-09 15:07:02 -05:00
Tonis Tiigi
70b363e54c session: fail stuck session RPCs on health timeout
Bind session RPC contexts to caller lifetime so ongoing RPCs fail when the
session is canceled. Add an integration test that blocks the session tunnel
and verifies the health monitor releases the hung build after timeout.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-04-02 23:29:16 -07:00
Dawei Wei
0c11cbc3bc ci: fix Windows ARM64 test compatibility
ARM64 test compatibility fixes:
- TestRunCacheWithMounts: create marker file (Windows-only) instead of
  checking whoami.exe (unavailable in nanoserver ARM64), use forward
  slashes for Shlex compat, preserve Linux code path unchanged
- TestDockerfileDirs: use findstr instead of fc /b (unavailable in nanoserver)
- TestExportLocalForcePlatformSplit: normalize platform before comparison
  (platforms.Normalize adds v8 variant on ARM64)

Signed-off-by: Dawei Wei <davwei@microsoft.com>
2026-04-01 18:49:02 +00:00
Tõnis Tiigi
05a3313f34 Merge pull request #6614 from tonistiigi/fix-history-panic2
[carry] history: fix panic when listing history
2026-03-25 13:17:54 -07:00
Tonis Tiigi
b4159310b5 history: fix nil events filtering
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-25 11:32:50 -07:00
Mateusz Gozdek
9239fc4077 solver/llbsolver/history: fix panic when listing history
I observed following panics couple of times while running
'docker buildx history ls'. This commit should fix it together with test
which allows reproducing the panic.

Stacktrace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x5571e75c90ae]
goroutine 16989985 [running]:
github.com/moby/buildkit/solver/llbsolver.filterHistoryEvents.func1(0xc015db4740?, 0x26?)
        github.com/moby/buildkit@v0.27.1/solver/llbsolver/history.go:1074 +0xe
slices.partitionCmpFunc[...]({0xc0014bb400?, 0x35, 0x40}, 0x0?, 0x7f13d47d6130, 0x5571e894e008?, 0x5571e894e008?)
        slices/zsortanyfunc.go:154 +0x27b
slices.pdqsortCmpFunc[...]({0xc0014bb400, 0x35, 0x40}, 0x5571e5660de7, 0xc00eeb1c98?, 0xc0011757a8?, 0x5571e894e008?)
        slices/zsortanyfunc.go:114 +0x2fe
slices.SortFunc[...](...)
        slices/sort.go:32
github.com/moby/buildkit/solver/llbsolver.filterHistoryEvents({0xc0014bb400, 0x35, 0x40}, {0x0?, 0x5571e7b577f2?, 0xc00442b410?}, 0x32)
        github.com/moby/buildkit@v0.27.1/solver/llbsolver/history.go:1073 +0x134
github.com/moby/buildkit/solver/llbsolver.(*HistoryQueue).Listen(0xc001b979e0, {0x5571e8999588, 0xc00d0ae930}, 0xc002e37e30, 0xc001175a28)
        github.com/moby/buildkit@v0.27.1/solver/llbsolver/history.go:1011 +0x80e
github.com/moby/buildkit/control.(*Controller).ListenBuildHistory(0xc0004c1500, 0xc002e37e30, {0x5571e89a8e40, 0xc00442b3e0})
        github.com/moby/buildkit@v0.27.1/control/control.go:311 +0xaf
github.com/moby/buildkit/api/services/control._Control_ListenBuildHistory_Handler({0x5571e8825da0, 0xc0004c1500}, {0x5571e89a4798, 0xc003c6c300})
        github.com/moby/buildkit@v0.27.1/api/services/control/control_grpc.pb.go:351 +0x110
github.com/moby/buildkit/util/grpcerrors.StreamServerInterceptor({0x5571e8825da0, 0xc0004c1500}, {0x5571e89a4798, 0xc003c6c300}, 0x5571e81b5140?, 0x5571e894bfc8)
        github.com/moby/buildkit@v0.27.1/util/grpcerrors/intercept.go:33 +0x5f
google.golang.org/grpc.(*Server).processStreamingRPC(0xc00189d448, {0x5571e8999588, 0xc00d0ae7b0}, 0xc002533a00, 0xc001362180, 0x5571ea24c8c0, 0x0)
        google.golang.org/grpc@v1.78.0/server.go:1721 +0x1151
google.golang.org/grpc.(*Server).handleStream(0xc00189d448, {0x5571e899b0d0, 0xc001f3ac30}, 0xc002533a00)
        google.golang.org/grpc@v1.78.0/server.go:1836 +0xd85
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.78.0/server.go:1063 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 16989982
        google.golang.org/grpc@v1.78.0/server.go:1074 +0x11d

Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
2026-03-25 10:07:26 +01:00
Tonis Tiigi
b3335475ee exporter: fix reporting push progress under export vertex
Wrap finalize calls in inBuilderContext with the same vertex
ID used during export, so push status (layers and manifest)
appears under the "exporting to image" vertex in the progress
stream instead of being reported without a parent context.

This broke when pushing was moved to be parallel step after
main export phase.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-17 00:19:49 -07:00
CrazyMax
d277c46008 Merge pull request #6570 from ngebremariam-msft/master
windows: test Updates for client, secrets and provenance
2026-03-11 18:16:37 +01:00
Natnael Gebremariam
73468e5c52 Test Updates for client, secrets and provenance
Signed-off-by: Natnael Gebremariam <ngebremariam@microsoft.com>
2026-03-11 08:53:20 -07:00