From c706c80b0de9ac828075e6ac065b17abf34b810e Mon Sep 17 00:00:00 2001 From: Soumik Majumder Date: Wed, 9 Oct 2024 14:58:48 +0530 Subject: [PATCH] Stricter caching for imgpkg bundles. Accounting for the entire source reference rather than just digest Signed-off-by: Soumik Majumder --- pkg/vendir/fetch/image/imgpkg.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/vendir/fetch/image/imgpkg.go b/pkg/vendir/fetch/image/imgpkg.go index 9b6aa1ff..4fed61b7 100644 --- a/pkg/vendir/fetch/image/imgpkg.go +++ b/pkg/vendir/fetch/image/imgpkg.go @@ -63,8 +63,8 @@ func (t *Imgpkg) FetchBundleRecursively(imageRef, destination string) (string, e return "", err } - if _, hit := t.cache.Has(ImgpkgBundleArtifactType, ref.Identifier()); hit { - return imageRef, t.cache.CopyFrom(ImgpkgBundleArtifactType, ref.Identifier(), destination) + if _, hit := t.cache.Has(ImgpkgBundleArtifactType, ref.Name()); hit { + return imageRef, t.cache.CopyFrom(ImgpkgBundleArtifactType, ref.Name(), destination) } opts, err := t.RegistryOpts() @@ -83,7 +83,7 @@ func (t *Imgpkg) FetchBundleRecursively(imageRef, destination string) (string, e } if status.Cacheable { - err := t.cache.Save(ImgpkgBundleArtifactType, ref.Identifier(), destination) + err := t.cache.Save(ImgpkgBundleArtifactType, ref.Name(), destination) if err != nil { return "", err } @@ -103,8 +103,8 @@ func (t *Imgpkg) fetch(imageRef, destination string, isBundle bool) (string, err return "", err } - if _, hit := t.cache.Has(artifactType, ref.Identifier()); hit { - return imageRef, t.cache.CopyFrom(artifactType, ref.Identifier(), destination) + if _, hit := t.cache.Has(artifactType, ref.Name()); hit { + return imageRef, t.cache.CopyFrom(artifactType, ref.Name(), destination) } opts, err := t.RegistryOpts() @@ -123,7 +123,7 @@ func (t *Imgpkg) fetch(imageRef, destination string, isBundle bool) (string, err } if status.Cacheable { - err := t.cache.Save(artifactType, ref.Identifier(), destination) + err := t.cache.Save(artifactType, ref.Name(), destination) if err != nil { return "", err }