From b99e799f004a3b07b211dd36334e5bd23a0b2c23 Mon Sep 17 00:00:00 2001 From: Will Nonnemaker Date: Thu, 24 Apr 2025 14:21:50 -0700 Subject: [PATCH 1/2] Add BUILDKIT_SYNTAX option handling This fix allows building with a remote builder where frontend.dockerfile.v0 enabled = false in the buildkitd yaml file. Note that this change only allows the usage of BUILDKIT_SYNTAX with a custom frontend image, and using the #syntax directive in this case will still fail. Resolves: docker#3077 Signed-off-by: Will Nonnemaker --- build/opt.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/opt.go b/build/opt.go index 7770aad36265..d80a793a703a 100644 --- a/build/opt.go +++ b/build/opt.go @@ -116,6 +116,11 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt *O so.FrontendAttrs["cgroup-parent"] = opt.CgroupParent } + if v, ok := opt.BuildArgs["BUILDKIT_SYNTAX"]; ok { + so.Frontend = "gateway.v0" + so.FrontendAttrs["source"] = v + } + if v, ok := opt.BuildArgs["BUILDKIT_MULTI_PLATFORM"]; ok { if v, _ := strconv.ParseBool(v); v { so.FrontendAttrs["multi-platform"] = "true" From fc3ecb60fbafee268d1faf84119adc476efe02b9 Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Tue, 26 Aug 2025 13:56:07 -0700 Subject: [PATCH 2/2] Preserve raw BUILDKIT_SYNTAX as cmdline option Set gateway `source` to the first part of `BUILDKIT_SYNTAX` and `cmdline` to the entire raw value to preserve additional options. Signed-off-by: Dan Duvall --- build/opt.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/opt.go b/build/opt.go index d80a793a703a..841037427462 100644 --- a/build/opt.go +++ b/build/opt.go @@ -117,8 +117,10 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt *O } if v, ok := opt.BuildArgs["BUILDKIT_SYNTAX"]; ok { + p := strings.SplitN(strings.TrimSpace(v), " ", 2) so.Frontend = "gateway.v0" - so.FrontendAttrs["source"] = v + so.FrontendAttrs["source"] = p[0] + so.FrontendAttrs["cmdline"] = v } if v, ok := opt.BuildArgs["BUILDKIT_MULTI_PLATFORM"]; ok {