@@ -1252,7 +1252,12 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
12521252 }
12531253 }
12541254
1255- dt , desc , err := itpull .Combine (ctx , srcs , nil )
1255+ indexAnnotations , err := extractIndexAnnotations (opt .Exports )
1256+ if err != nil {
1257+ return err
1258+ }
1259+
1260+ dt , desc , err := itpull .Combine (ctx , srcs , indexAnnotations )
12561261 if err != nil {
12571262 return err
12581263 }
@@ -1332,6 +1337,23 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
13321337 return resp , nil
13331338}
13341339
1340+ // extractIndexAnnotations extracts annotations for the OCI index from export attributes
1341+ func extractIndexAnnotations (exports []client.ExportEntry ) ([]string , error ) {
1342+ var annotations []string
1343+ for _ , exp := range exports {
1344+ for k , v := range exp .Attrs {
1345+ if key , ok := strings .CutPrefix (k , "annotation-index." ); ok {
1346+ annotations = append (annotations , fmt .Sprintf ("index:%s=%s" , key , v ))
1347+ } else if key , ok := strings .CutPrefix (k , "annotation-manifest-descriptor." ); ok {
1348+ annotations = append (annotations , fmt .Sprintf ("manifest-descriptor:%s=%s" , key , v ))
1349+ } else if key , ok := strings .CutPrefix (k , "annotation." ); ok && ! strings .Contains (k , "-" ) {
1350+ annotations = append (annotations , fmt .Sprintf ("%s=%s" , key , v ))
1351+ }
1352+ }
1353+ }
1354+ return annotations , nil
1355+ }
1356+
13351357func pushWithMoby (ctx context.Context , d driver.Driver , name string , l progress.SubLogger ) error {
13361358 api := d .Config ().DockerAPI
13371359 if api == nil {
0 commit comments