The Wayback Machine - https://web.archive.org/web/20251014182858/https://github.com/docker/buildx/pull/2864
Skip to content

Conversation

crazy-max
Copy link
Member

fixes #2853

We should validate buildkit configuration before creating the builder.

@crazy-max crazy-max added this to the v0.20.0 milestone Dec 16, 2024
Copy link
Contributor

@dvdksn dvdksn left a comment

Choose a reason for hiding this comment

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

🎉

$ docker buildx create --buildkitd-config cfg.toml 
ERROR: failed to parse buildkit config: (2, 1): Can't convert maybe(string) to bool
if err != nil {
return t, errors.Wrap(err, "failed to parse config")
return t, errors.Wrap(err, "failed to parse buildkit config")
}
Copy link
Member

Choose a reason for hiding this comment

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

Wondering; will this be problematic when crating a builder using an older version of buildkit? (i.e. would validation only work correctly if the version matches the one that's vendored?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this will be an issue as we are backward compat. Also we are already using this logic to get the registry config in

config, err := buildkitdconfig.Load(bytes.NewReader(dt))
if err != nil {
return opt, err
}

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah, I wasn't sure, so thought I'd mention it. I recall that I ran into changes in the garbage-collect configuration that changed, and for which I needed to make changes in moby/moby, because it used those; moby/moby#48634 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test for this, making sure a new unknown key doesn't cause a validation error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max force-pushed the builder-validate-config branch from 861f42a to 07db2be Compare January 8, 2025 13:57
@tonistiigi tonistiigi merged commit 38b7199 into docker:master Jan 8, 2025
124 checks passed
@crazy-max crazy-max deleted the builder-validate-config branch January 8, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment