Commit Graph
222 Commits
Author SHA1 Message Date
Pierre Gimalac c4b1789093 driver/kubernetes: close exec-stream pipes when the stream ends
Signed-off-by: Pierre Gimalac <23154723+pgimalac@users.noreply.github.com>
2026-07-22 16:15:50 +00:00
CrazyMaxandGitHub b0ec760812 Merge pull request #3928 from jarqvi/fix-remote-driver-authority
remote: use endpoint address for buildkit client authority
2026-07-21 18:32:48 +02:00
Tõnis TiigiandGitHub 2adf2bc447 Merge pull request #3861 from areebahmeddd/fix/random-pods
route bake targets across pods with random loadbalance
2026-07-15 09:05:30 -07:00
MohammadHasan Akbari b2878907cc remote: set grpc authority as a default option
Add the ":authority" dial option to the default client options instead of
appending it after the caller-provided options, so that an authority
explicitly passed by the caller takes precedence over the driver default.

Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
2026-07-14 09:46:00 +04:00
Paweł Gronowski 21de7d2078 build: Fix iidfile for containerd-backed Docker driver
Images loaded into Docker's containerd image store are identified by
their manifest or index digest, while the legacy graphdriver store uses
the config digest.

buildx prefers containerimage.config.digest when the Moby exporter
returns both digests.
Some exporter responses still produce a usable iidfile, but affected
builds, such as those with attestations disabled, write a config digest
that Docker image commands cannot resolve.

Expose the Docker driver's image-store mode as a feature and set
prefer-image-digest for containerd-backed Moby exports.

Signed-off-by: Paweł Gronowski <git@grono.dev>
2026-07-13 20:01:34 +02:00
MohammadHasan Akbari 877de7edf2 remote: prefer servername for grpc authority
When the servername driver-opt is set it is also used for TLS SNI and
certificate validation, so use it for the gRPC ":authority" pseudo-header
as well, falling back to the endpoint host otherwise. This matches how the
buildkit client derives the authority from the server name when TLS
credentials are supplied.

Since the driver terminates TLS in its own dialer, the authority is set
explicitly via client.WithGRPCDialOption(grpc.WithAuthority(...)).

Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
2026-07-11 10:17:12 +04:00
Areeb Ahmed ec41ad745d fix random pod spread
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
2026-07-08 15:44:39 +03:00
MohammadHasan Akbari d3d1828d84 remote: use endpoint address for buildkit client authority
The remote driver created the buildkit client with an empty address:

    client.New(ctx, "", opts...)

With an empty address the buildkit client falls back to the system
default address (the local unix socket) and derives the gRPC
":authority" pseudo-header from it, which ends up being "localhost".
The actual connection was still correct because the remote driver
provides its own dialer, but the wrong authority broke HTTP/2 reverse
proxies (such as Envoy) that route based on ":authority".

Pass the configured endpoint address to client.New so the authority is
derived from the remote endpoint hostname (e.g.
my-buildkit.example.com:443). The custom dialer is preserved, so the
dial target and TLS/SNI behavior are unchanged.

Fixes #3880

Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
2026-06-28 15:24:28 +04:00
Akihiro SudaandGitHub f5fb6314e7 Merge pull request #3858 from areebahmeddd/fix/volume-memory
fix rootless buildkit memory volume path
2026-05-28 09:16:07 +09:00
Areeb Ahmed 1509ad3d3c add test
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
2026-05-20 15:38:13 +03:00
Areeb Ahmed 8653d93453 correct path
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
2026-05-19 02:34:51 +03:00
Jonathan A. Sternberg 74a2218e9c driver/kubernetes: fix panic when using statefulset in kubernetes driver
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-05-18 10:46:17 -05:00
Sebastiaan van Stijn 76ba2fac5c driver/docker-container: remove uses of jsonmessage
This function was always using `io.Discard` for printing the progress,
so we can use the `Wait()` method, which reads the stream, returning
any error (similar to jsonmessage.DisplayJSONMessagesStream), and
closes the stream either if the context is cancelled, or if the
stream ends.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-21 13:35:39 +02:00
CrazyMax 48fd4cb3cc driver: only mount WSL libraries for local docker-container endpoints
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-04-08 09:39:11 +02:00
Sebastiaan van Stijn 3b630c6437 vendor: moby/client v0.4.0, moby/api v1.54.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-03 16:05:48 +02:00
Jonathan A. Sternberg 0a0fc905a6 feat: add persistent storage options to k8s driver
The k8s driver now supports the `persistent-volume-claim.requests.storage`
option. Setting this option changes the deployment into a statefulset
and creates a persistent volume claim where the buildkit data is stored.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-04-01 15:44:51 -05:00
Tonis Tiigi 6124ad9da4 kubernetes: lazily initialize kubeclient scheme
Use sync.OnceValue to initialize the kubeclient scheme, codec factory,
and parameter codec as a single lazy-loaded bundle.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-06 16:55:48 -08:00
Tonis Tiigi 5a7f7c286f kubernetes: trim client-go dependency surface
Replace the full generated clientset and global Kubernetes scheme
with a small local REST client layer and minimal scheme registration.

This keeps the existing kubeconfig/auth and remote exec behavior while
significantly reducing the linked and vendored Kubernetes dependency set.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-06 16:44:18 -08:00
Tonis Tiigi 27dde04ab5 imagetools: use dockerconfig for auth
Enables fallback for DHI and Scout registries and
repo/scope specific credentials like supported for builds.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-26 10:15:14 -08:00
Tonis Tiigi c5154b3169 update linters for go1.25 base version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-09 18:54:15 -08:00
Akihiro SudaandGitHub 66f4f62159 Merge pull request #3493 from Guimove/fix-k8s-tls-retry-2668
driver/kubernetes: Add retry logic for transient TLS connection errors
2026-01-06 14:31:10 +08:00
guimove e758a6b917 driver/kubernetes: Add retry logic for transient TLS connection errors
Fixes #2668

When Kubernetes marks nodes as "Ready" before their Certificate Signing
Requests (CSRs) are approved, the buildx kubernetes driver can fail to
connect to builder pods with transient TLS errors like:
  - "tls: internal error"
  - "context deadline exceeded"
  - "use of closed network connection"
  - "i/o timeout"

This is particularly problematic on EKS clusters with ARM64 nodes under
heavy load, where multiple builders are being spawned simultaneously.

This commit adds retry logic with exponential backoff to the Dial()
function in the kubernetes driver. The implementation:
  - Attempts up to 5 connection retries
  - Uses exponential backoff starting at 500ms, capped at 10s
  - Only retries on known transient connection errors
  - Uses errors.Is/errors.As for proper error type checking
  - Logs retry attempts using logrus for visibility
  - Respects context cancellation

This allows buildx to gracefully handle the race condition where pods
are marked as Running before their TLS certificates are fully ready.

Signed-off-by: guimove <dasilva.guillaume@live.fr>
2026-01-05 17:46:10 +01:00
Sebastiaan van Stijn 88b4d5ae03 driver/kubernetes: change DeploymentOpt.Replicas to int32
Directly convert to a int32 instead of later conversion so that
we can return an error if the value is out of range.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-27 22:41:57 +01:00
Sebastiaan van Stijn 18dc2e088a vendor: github.com/moby/moby/api v1.52.0, moby/client v0.1.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-12 01:30:02 +01:00
CrazyMax 7652057da2 docker-container: write github actions payload to container for provenance
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-24 10:52:49 +02:00
Sebastiaan van Stijn 1126d853a8 driver/kubernetes/context: don't use ResolveDefaultContext in test
The ResolveDefaultContext function is only used internally by the CLI,
and has no known external users, except for this test in buildx. It was
exported in [cli@f820766] to allow (unit) testing, but did not document
that it was only exported for this purpose.

This patch rewrites the test to allow deprecating / removing the function
in the CLI.

[cli@f820766]: https://github.com/docker/cli/commit/f820766f6ac57188d96c9ca377f2b4627e90da28

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-01 11:31:09 +02:00
Tonis Tiigi 9f721e3190 kubernetes: add env driver opt to kubernetes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-08-18 18:11:53 +03:00
Tõnis TiigiandGitHub 10605b8c35 Merge pull request #3320 from crazy-max/mount-wsl-lib
driver: mount wsl lib folder for docker-container driver
2025-08-13 15:42:38 +03:00
CrazyMax ed67ab795b driver: mount wsl lib folder for docker-container driver
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-07-21 16:47:20 +02:00
Sebastiaan van Stijn 3f725bf4d8 driver/kubernetes: remove uses of pkg/homedir
Create a local fork to keep the existing behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 14:46:45 +02:00
Sebastiaan van Stijn fd87647da1 use "#nosec" instead of "nolint:gosec" to be more specific
The `#nosec` comment allows ignoring a specific rule; this prevents
potentially other "gosec" linting failulres from being silently ignored.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-03 13:31:06 +02:00
Samuel Archambault d5f914a263 driver kubernetes: allow to work in a Memory mount to speed up things
Signed-off-by: Samuel Archambault <samuel.archambault@getmaintainx.com>
2025-06-18 14:49:54 -04:00
Sebastiaan van Stijn bc620fcc71 vendor: github.com/docker/docker v28.2.1
full diff: https://github.com/docker/docker/compare/v28.1.1...v28.2.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-29 09:34:27 +02:00
CrazyMax 1383aa30c1 lint: modernize fix
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-05-13 20:44:57 +02:00
CrazyMax b606e2f6bb update golangci-lint to v2.1.5
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-05-13 16:54:43 +02:00
Sebastiaan van Stijn fa0c3e3786 migrate to github.com/moby/go-archive module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-10 09:16:43 +02:00
co63oc 7659798f80 Fix typos
Signed-off-by: co63oc <co63oc@users.noreply.github.com>
2025-04-07 14:01:52 +08:00
CrazyMax 337578242d driver: request gpu when creating container builder
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-03-13 17:36:37 +01:00
Tonis Tiigi d5d3d3d502 lint: apply x/tools/modernize fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-03-07 16:37:24 -08:00
co63oc 7925a96726 Fix
Signed-off-by: co63oc <co63oc@users.noreply.github.com>
2025-03-02 21:20:50 +08:00
Tonis Tiigi 4f7d145c0e avoid double pushing with docker driver with containerd
In this mode buildkit can push directly so pushing manually
with docker would result in pushing image twice.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-02-24 16:48:57 -08:00
Sebastiaan van StijnandCrazyMax b85fc5c484 vendor: github.com/docker/docker/v28.0.0-rc.1
full diff: https://github.com/docker/docker/compare/v27.5.1..v28.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-13 13:53:44 +01:00
Tõnis TiigiandGitHub 2389d457a4 Merge pull request #2988 from crazy-max/ctn-driver-display-pull-error
docker-container: check error from response body when pulling image
2025-02-12 08:47:05 -08:00
CrazyMax 3f82aadc6e docker-container: check error from response body when pulling image
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-12 12:35:27 +01:00
CrazyMax cee7b344da Revert "vendor: github.com/docker/docker/v28.0.0-rc.1"
This reverts commit b195b80ddf.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-11 18:14:49 +01:00
Sebastiaan van Stijn b195b80ddf vendor: github.com/docker/docker/v28.0.0-rc.1
full diff: https://github.com/docker/docker/compare/v27.5.1..v28.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 11:07:35 +01:00
Sebastiaan van Stijn 3bd54b19aa driver/docker-container: remove uses of dockerclient.IsErrNotFound
It's a wrapper around errdefs.IsNotFound, which is already used, so we
can skip the wrapper.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-01 15:22:33 +01:00
Tonis Tiigi d2c512a95b lint: enable testifylint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-20 10:53:11 -08:00
CrazyMax e04da86aca fix golangci-lint issues
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:20:17 +01:00
Tonis Tiigi e7a53fb829 lint: enable forbidigo context rules
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-19 18:27:25 -08:00