Skip to content

Commit

Permalink
Stricter caching for imgpkg bundles. Accounting for the entire source…
Browse files Browse the repository at this point in the history
… reference rather than just digest

Signed-off-by: Soumik Majumder <[email protected]>
  • Loading branch information
100mik committed Oct 9, 2024
1 parent 09ab9ab commit c706c80
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/vendir/fetch/image/imgpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand All @@ -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()
Expand All @@ -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
}
Expand Down

0 comments on commit c706c80

Please sign in to comment.