build: read provenance response mode in commands pkg

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-06-24 14:32:26 +02:00
parent 9b100c2552
commit d155747029
8 changed files with 161 additions and 146 deletions

View File

@ -202,12 +202,17 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
return nil
}
prm := confutil.MetadataProvenance()
if len(in.metadataFile) == 0 {
prm = confutil.MetadataProvenanceModeDisabled
}
groupRef := identity.NewID()
var refs []string
for k, b := range bo {
b.Ref = identity.NewID()
b.GroupRef = groupRef
b.WithProvenanceResponse = len(in.metadataFile) > 0
b.ProvenanceResponseMode = prm
refs = append(refs, b.Ref)
bo[k] = b
}