mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-19 01:47:43 +08:00
build: avoid compatability error when attestations disabled
We should avoid erroring with attestations support compatability errors when a user has specified --provenance=false. A user may wish to enable --provenance=false that works across buildkit versions, but currently it will fail on old versions - this patch fixes this, to silently ignore the provenance flag for this check if it's set to disabled. Signed-off-by: Justin Chadwell <me@jedevc.com> (cherry picked from commit 15a80b56b5d015baf40ff2393f424ff0bcc51d2b) Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
b7781447d7
commit
033d5629c0
@ -588,18 +588,22 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(opt.Attests) > 0 {
|
attests := make(map[string]string)
|
||||||
if !bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) {
|
for k, v := range opt.Attests {
|
||||||
return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd")
|
if v != nil {
|
||||||
}
|
attests[k] = *v
|
||||||
for k, v := range opt.Attests {
|
|
||||||
if v == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
so.FrontendAttrs[k] = *v
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := opt.Attests["attest:provenance"]; !ok {
|
supportsAttestations := bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations"))
|
||||||
|
if len(attests) > 0 {
|
||||||
|
if !supportsAttestations {
|
||||||
|
return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd")
|
||||||
|
}
|
||||||
|
for k, v := range attests {
|
||||||
|
so.FrontendAttrs[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := opt.Attests["attest:provenance"]; !ok && supportsAttestations {
|
||||||
so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true"
|
so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user