Pass in index annotations from builds on multiple nodes

Fixes #2540

Signed-off-by: Eli Treuherz <et@arenko.group>
This commit is contained in:
Eli Treuherz
2024-06-21 11:56:54 +01:00
parent 9b100c2552
commit 3971361ed2
4 changed files with 27 additions and 10 deletions

View File

@@ -61,6 +61,7 @@ type Options struct {
Ref string
Allow []entitlements.Entitlement
Annotations map[exptypes.AnnotationKey]string
Attests map[string]*string
BuildArgs map[string]string
CacheFrom []client.CacheOptionsEntry
@@ -607,7 +608,8 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
}
}
dt, desc, err := itpull.Combine(ctx, srcs, nil, false)
filteredAnnotations := filterIndexAnnotations(opt.Annotations)
dt, desc, err := itpull.Combine(ctx, srcs, filteredAnnotations, false)
if err != nil {
return err
}
@@ -655,6 +657,17 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
return resp, nil
}
func filterIndexAnnotations(annotations map[exptypes.AnnotationKey]string) map[exptypes.AnnotationKey]string {
filteredAnnotations := map[exptypes.AnnotationKey]string{}
for k, v := range annotations {
switch k.Type {
case exptypes.AnnotationIndex, exptypes.AnnotationManifestDescriptor:
filteredAnnotations[k] = v
}
}
return filteredAnnotations
}
func pushWithMoby(ctx context.Context, d *driver.DriverHandle, name string, l progress.SubLogger) error {
api := d.Config().DockerAPI
if api == nil {