Skip to content

remove buildx as a Go dependency - #14123

Merged
ndeloof merged 2 commits into
mainfrom
remove-buildx-dependency
Aug 25, 2026
Merged

remove buildx as a Go dependency#14123
ndeloof merged 2 commits into
mainfrom
remove-buildx-dependency

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

buildx was imported for two narrow purposes, both now covered by docker/cli machinery compose already uses elsewhere:

  • storeutil.GetProxyConfigconfigfile.ParseProxyConfig, the same lookup docker build uses. Behavioral note: build args now also pick up ALL_PROXY and the lowercase proxy variants, matching docker build.
  • the dry-run image resolver (buildx/builder + imagetools) → a DistributionInspect through the daemon with credentials from the CLI config file — the same path the real pull/push would take. The encoded-auth helper moves to internal/registry, shared with pull.go.

bake is unaffected: it already execs the buildx CLI plugin rather than importing it. Dropping the module removes 23 buildx packages from the binary and the whole transitive aws-sdk-go-v2 footprint (−328 lines of go.sum).

Follows up on the intent recorded in build_bake.go: "long term plan is to remove buildx as a dependency".

🤖 Generated with Claude Code

// EncodedAuth returns the credentials for the registry hosting the given
// image reference, base64-encoded as expected by the Docker API's
// X-Registry-Auth header.
func EncodedAuth(ref reference.Named, cfg AuthProvider) (string, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread internal/registry/registry.go Outdated
@ndeloof
ndeloof force-pushed the remove-buildx-dependency branch from c1c6c87 to 5a6bace Compare August 25, 2026 13:37
@ndeloof
ndeloof marked this pull request as ready for review August 25, 2026 13:39
@ndeloof
ndeloof requested review from a team as code owners August 25, 2026 13:39
@ndeloof
ndeloof requested a review from glours August 25, 2026 13:39
thaJeztah
thaJeztah previously approved these changes Aug 25, 2026

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

buildx was imported for two narrow purposes, both replaced by
docker/cli machinery compose already uses elsewhere:

- storeutil.GetProxyConfig -> configfile.ParseProxyConfig, the same
  lookup docker build uses (also picks up ALL_PROXY and lowercase
  variants)
- the dry-run image resolver (buildx builder + imagetools) -> a
  DistributionInspect through the daemon with credentials from the CLI
  config file, i.e. the same path a real pull/push would take; the
  encoded-auth helper moves to internal/registry, shared with pull.go

bake is unaffected: it already execs the buildx CLI plugin. Dropping
the module also drops the transitive aws-sdk-go-v2 footprint
(-328 lines of go.sum).

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
EncodedAuth now delegates the X-Registry-Auth wire encoding to
moby/api/pkg/authconfig (same module, already required) instead of
hand-rolling the JSON+base64url pair, and push.go reuses it instead of
its own copy. The CLI and moby AuthConfig structs are field-for-field
identical, so a direct type conversion bridges them.

The explicit GetAuthConfigKey normalization drops out of EncodedAuth:
docker/cli's configfile.GetAuthConfig normalizes the Docker Hub domain
itself. It remains for the OCI resolver, whose credential callback
receives the network host actually contacted (registry-1.docker.io),
which the configfile does not map.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Comment thread pkg/compose/compose.go
Comment on lines +252 to +253
m := make(map[string]*string, len(s.proxyConfig))
for k, v := range s.proxyConfig {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh; no idea TBH why we picked a map with pointers for this in the CLI (otherwise this could've been a maps.Clone 😞

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, or was this perhaps for the "nil means "take from current environment"?

@glours glours left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 LGTM!!! SHIP!!!!

@ndeloof
ndeloof merged commit a472f71 into main Aug 25, 2026
94 of 95 checks passed
@ndeloof
ndeloof deleted the remove-buildx-dependency branch August 25, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants