Skip to content

Commit

Permalink
inline cache: fix blob indexes by uncompressed digest
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Feb 4, 2023
1 parent d082c9b commit 39ff1c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cache/remotecache/inline/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,20 @@ func (ce *exporter) ExportForLayers(ctx context.Context, layers []digest.Digest)
return nil, err
}

layerBlobDigests := make([]digest.Digest, len(layers))

descs2 := map[digest.Digest]v1.DescriptorProviderPair{}
for _, k := range layers {
for i, k := range layers {
if v, ok := descs[k]; ok {
descs2[k] = v
layerBlobDigests[i] = k
continue
}
// fallback for uncompressed digests
for _, v := range descs {
if uc := v.Descriptor.Annotations["containerd.io/uncompressed"]; uc == string(k) {
descs2[v.Descriptor.Digest] = v
layerBlobDigests[i] = v.Descriptor.Digest
}
}
}
Expand All @@ -87,7 +91,7 @@ func (ce *exporter) ExportForLayers(ctx context.Context, layers []digest.Digest)

// reorder layers based on the order in the image
blobIndexes := make(map[digest.Digest]int, len(layers))
for i, blob := range layers {
for i, blob := range layerBlobDigests {
blobIndexes[blob] = i
}

Expand Down

0 comments on commit 39ff1c0

Please sign in to comment.