Merge pull request #1827 from TomChv/fix/add-platform-metadata-to-pushed-image

Complete exportImageConfig to bind platform metadata
This commit is contained in:
Andrea Luzzardi 2022-03-22 10:55:22 -07:00 committed by GitHub
commit e484477bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,9 +67,15 @@ func (c *pushTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.
return nil, err return nil, err
} }
// Add platform to image configuration
exportImageConfig := &dockerfile2llb.Image{Config: imageConfig.ToSpec()}
exportImageConfig.OS = pctx.Platform.Get().OS
exportImageConfig.Architecture = pctx.Platform.Get().Architecture
exportImageConfig.Variant = pctx.Platform.Get().Variant
// Export image // Export image
lg.Debug().Str("dest", dest.String()).Msg("export image") lg.Debug().Str("dest", dest.String()).Msg("export image")
resp, err := s.Export(ctx, st, &dockerfile2llb.Image{Config: imageConfig.ToSpec()}, bk.ExportEntry{ resp, err := s.Export(ctx, st, exportImageConfig, bk.ExportEntry{
Type: bk.ExporterImage, Type: bk.ExporterImage,
Attrs: map[string]string{ Attrs: map[string]string{
"name": dest.String(), "name": dest.String(),