@@ -61,16 +61,12 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
6161 } else {
6262 p = platforms .DefaultSpec ()
6363 }
64-
65- k := platforms .FormatAll (p )
66- p = extendWindowsPlatform (p , img .Platform )
67- p = platforms .Normalize (p )
68-
64+ expPlat := normalizePlatform (p , img .Platform )
6965 if bc .MultiPlatformRequested {
70- res .AddRef (k , ref )
71- res .AddMeta (fmt .Sprintf ("%s/%s" , exptypes .ExporterImageConfigKey , k ), config )
66+ res .AddRef (expPlat . ID , ref )
67+ res .AddMeta (fmt .Sprintf ("%s/%s" , exptypes .ExporterImageConfigKey , expPlat . ID ), config )
7268 if len (baseConfig ) > 0 {
73- res .AddMeta (fmt .Sprintf ("%s/%s" , exptypes .ExporterImageBaseConfigKey , k ), baseConfig )
69+ res .AddMeta (fmt .Sprintf ("%s/%s" , exptypes .ExporterImageBaseConfigKey , expPlat . ID ), baseConfig )
7470 }
7571 } else {
7672 res .SetRef (ref )
@@ -79,10 +75,7 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
7975 res .AddMeta (exptypes .ExporterImageBaseConfigKey , baseConfig )
8076 }
8177 }
82- expPlatforms .Platforms [i ] = exptypes.Platform {
83- ID : k ,
84- Platform : p ,
85- }
78+ expPlatforms .Platforms [i ] = expPlat
8679 return nil
8780 })
8881 }
@@ -133,3 +126,13 @@ func extendWindowsPlatform(p, imgP ocispecs.Platform) ocispecs.Platform {
133126 }
134127 return p
135128}
129+
130+ func normalizePlatform (p , imgP ocispecs.Platform ) exptypes.Platform {
131+ k := platforms .FormatAll (p )
132+ p = extendWindowsPlatform (p , imgP )
133+ p = platforms .Normalize (p )
134+ return exptypes.Platform {
135+ ID : k ,
136+ Platform : p ,
137+ }
138+ }
0 commit comments