Skip cache lookup for "FROM scratch" in containerd

Ideally, this should actually do a lookup across images that have no parent, but I wasn't 100% sure how to accomplish that so I opted for the smaller change of having `FROM scratch` builds not be cached for now.

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
(cherry picked from commit 1741771b67)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Tianon Gravi 2023-06-26 16:01:34 -07:00 committed by Sebastiaan van Stijn
parent 5899e935d4
commit e84365f967
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -31,6 +31,12 @@ type imageCache struct {
func (ic *imageCache) GetCache(parentID string, cfg *container.Config) (imageID string, err error) {
ctx := context.TODO()
if parentID == "" {
// TODO handle "parentless" image cache lookups ("FROM scratch")
return "", nil
}
parent, err := ic.c.GetImage(ctx, parentID, imagetype.GetImageOpts{})
if err != nil {
return "", err