mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
Merge pull request #2546 from treuherz/multinode-annotations
Pass in index annotations from builds on multiple nodes
This commit is contained in:
@ -608,7 +608,12 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
|
||||
}
|
||||
}
|
||||
|
||||
dt, desc, err := itpull.Combine(ctx, srcs, nil, false)
|
||||
indexAnnotations, err := extractIndexAnnotations(opt.Exports)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dt, desc, err := itpull.Combine(ctx, srcs, indexAnnotations, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -656,6 +661,27 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func extractIndexAnnotations(exports []client.ExportEntry) (map[exptypes.AnnotationKey]string, error) {
|
||||
annotations := map[exptypes.AnnotationKey]string{}
|
||||
for _, exp := range exports {
|
||||
for k, v := range exp.Attrs {
|
||||
ak, ok, err := exptypes.ParseAnnotationKey(k)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch ak.Type {
|
||||
case exptypes.AnnotationIndex, exptypes.AnnotationManifestDescriptor:
|
||||
annotations[ak] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
return annotations, nil
|
||||
}
|
||||
|
||||
func pushWithMoby(ctx context.Context, d *driver.DriverHandle, name string, l progress.SubLogger) error {
|
||||
api := d.Config().DockerAPI
|
||||
if api == nil {
|
||||
|
Reference in New Issue
Block a user