gateway: route dockerfile.v0 source to builtin frontend#6643
gateway: route dockerfile.v0 source to builtin frontend#6643crazy-max wants to merge 1 commit intomoby:masterfrom
Conversation
7067599 to
75e48b4
Compare
frontend/gateway/gateway.go
Outdated
| return nil, errors.Errorf("no source specified for gateway") | ||
| } | ||
|
|
||
| if cmdline := strings.TrimSpace(opts["cmdline"]); cmdline == "dockerfile.v0" { |
There was a problem hiding this comment.
why is this checking cmdline instead of just source == "dockerfile.v0
There was a problem hiding this comment.
I think cmdline is stricter than source. Buildx sets source to the first token of BUILDKIT_SYNTAX and keeps the original value in cmdline, so checking only source would also treat values like dockerfile.v0 foo as the builtin selector. I keyed it off strings.TrimSpace(cmdline) == "dockerfile.v0" to keep the special case limited to the exact selector and avoid changing behavior for malformed values. If you prefer source == "dockerfile.v0" for simplicity, I can switch it.
There was a problem hiding this comment.
The contract is that gateway will load whatever is in the source option. cmdline is just a way to pass arguments that are not parsed by buildkit itself. So I think we should only use source.
75e48b4 to
cc113e9
Compare
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
cc113e9 to
80b841c
Compare
|
|
||
| var pred provenancetypes.ProvenancePredicateSLSA1 | ||
| require.NoError(t, json.Unmarshal(dt, &pred)) | ||
| require.Empty(t, pred.BuildDefinition.ExternalParameters.Request.Frontend) |
There was a problem hiding this comment.
Why is empty correct here? Shouldn't it be dockerfile.v0?
alternative to and closes #6594
The gateway frontend now checks the forwarded
sourceand short-circuits to the built-in Dockerfile frontend for the exactdockerfile.v0selector.