controller: handle attestation options across api

We can perform all attestation processing, handling how the sbom and
provenance arguments interact on the client, while applying defaults on
the server.

Additionally, this allows us to start pulling fields out of CommonOpts.

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-02-15 14:24:09 +00:00
parent 0b8f0264b0
commit c2e11196dd
9 changed files with 274 additions and 204 deletions

View File

@ -455,11 +455,11 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd")
}
for k, v := range attests {
so.FrontendAttrs[k] = v
so.FrontendAttrs["attest:"+k] = v
}
}
if _, ok := opt.Attests["attest:provenance"]; !ok && supportsAttestations {
if _, ok := opt.Attests["provenance"]; !ok && supportsAttestations {
const noAttestEnv = "BUILDX_NO_DEFAULT_ATTESTATIONS"
var noProv bool
if v, ok := os.LookupEnv(noAttestEnv); ok {