Merge pull request #46310 from vvoland/c8d-legacybuilder-fix-layermismatch-24
[24.0 backport] c8d/legacybuilder: Fix `mismatched image rootfs` errors
This commit is contained in:
commit
8ff9ef2a7a
2 changed files with 10 additions and 4 deletions
|
@ -505,9 +505,6 @@ func (i *ImageService) CreateImage(ctx context.Context, config []byte, parent st
|
|||
return nil, err
|
||||
}
|
||||
|
||||
newImage := dimage.NewImage(dimage.ID(createdImage.Target.Digest))
|
||||
newImage.V1Image = imgToCreate.V1Image
|
||||
newImage.V1Image.ID = string(createdImage.Target.Digest)
|
||||
newImage.History = imgToCreate.History
|
||||
newImage := dimage.Clone(imgToCreate, dimage.ID(createdImage.Target.Digest))
|
||||
return newImage, nil
|
||||
}
|
||||
|
|
|
@ -248,6 +248,15 @@ func NewChildImage(img *Image, child ChildConfig, os string) *Image {
|
|||
}
|
||||
}
|
||||
|
||||
// Clone clones an image and changes ID.
|
||||
func Clone(base *Image, id ID) *Image {
|
||||
img := *base
|
||||
img.RootFS = img.RootFS.Clone()
|
||||
img.V1Image.ID = id.String()
|
||||
img.computedID = id
|
||||
return &img
|
||||
}
|
||||
|
||||
// History stores build commands that were used to create an image
|
||||
type History struct {
|
||||
// Created is the timestamp at which the image was created
|
||||
|
|
Loading…
Reference in a new issue