bake: merge attest entries

This ensures that `target.attest=["type=sbom,<value>"]` can be
appropriately merged when `--sbom=true` or `--set
target.attest=type=sbom`.

To merge, we simply naively take the last valid value.

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-05-19 14:32:58 +01:00
parent c9c1303e31
commit 90c849f5ef
3 changed files with 57 additions and 3 deletions

View File

@ -25,7 +25,7 @@ func ParseAttests(in []string) ([]*controllerapi.Attest, error) {
found := map[string]struct{}{}
for _, in := range in {
in := in
attest, err := parseAttest(in)
attest, err := ParseAttest(in)
if err != nil {
return nil, err
}
@ -40,7 +40,7 @@ func ParseAttests(in []string) ([]*controllerapi.Attest, error) {
return out, nil
}
func parseAttest(in string) (*controllerapi.Attest, error) {
func ParseAttest(in string) (*controllerapi.Attest, error) {
if in == "" {
return nil, nil
}