vendor: github.com/moby/buildkit v0.13.0-rc2

full diff: https://github.com/moby/buildkit/compare/8e3fe35738c2...v0.13.0-rc2

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-02-24 14:38:34 +01:00
parent 545a5c97c6
commit e423a67f7b
89 changed files with 1427 additions and 575 deletions

View File

@ -14,7 +14,7 @@ import (
"golang.org/x/sync/errgroup"
)
type BuildFunc func(ctx context.Context, platform *ocispecs.Platform, idx int) (client.Reference, *dockerspec.DockerOCIImage, error)
type BuildFunc func(ctx context.Context, platform *ocispecs.Platform, idx int) (r client.Reference, img, baseImg *dockerspec.DockerOCIImage, err error)
func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, error) {
res := client.NewResult()
@ -36,7 +36,7 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
for i, tp := range targets {
i, tp := i, tp
eg.Go(func() error {
ref, img, err := fn(ctx, tp, i)
ref, img, baseImg, err := fn(ctx, tp, i)
if err != nil {
return err
}
@ -46,6 +46,14 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
return errors.Wrapf(err, "failed to marshal image config")
}
var baseConfig []byte
if baseImg != nil {
baseConfig, err = json.Marshal(baseImg)
if err != nil {
return errors.Wrapf(err, "failed to marshal source image config")
}
}
p := platforms.DefaultSpec()
if tp != nil {
p = *tp
@ -67,9 +75,15 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
if bc.MultiPlatformRequested {
res.AddRef(k, ref)
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, k), config)
if len(baseConfig) > 0 {
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageBaseConfigKey, k), baseConfig)
}
} else {
res.SetRef(ref)
res.AddMeta(exptypes.ExporterImageConfigKey, config)
if len(baseConfig) > 0 {
res.AddMeta(exptypes.ExporterImageBaseConfigKey, baseConfig)
}
}
expPlatforms.Platforms[i] = exptypes.Platform{
ID: k,