mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-12 06:27:07 +08:00
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:
20
controller/pb/attest.go
Normal file
20
controller/pb/attest.go
Normal file
@ -0,0 +1,20 @@
|
||||
package pb
|
||||
|
||||
func CreateAttestations(attests []*Attest) map[string]*string {
|
||||
result := map[string]*string{}
|
||||
for _, attest := range attests {
|
||||
// ignore duplicates
|
||||
if _, ok := result[attest.Type]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
if attest.Disabled {
|
||||
result[attest.Type] = nil
|
||||
continue
|
||||
}
|
||||
|
||||
attrs := attest.Attrs
|
||||
result[attest.Type] = &attrs
|
||||
}
|
||||
return result
|
||||
}
|
Reference in New Issue
Block a user