fix(metadb): set LastUpdated field also for indexes (#2088)

Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
Andreea Lupu
2023-11-29 15:15:39 +02:00
committed by GitHub
parent 3c8da6e6fc
commit e59d8da454
3 changed files with 86 additions and 2 deletions
+13 -2
View File
@@ -233,13 +233,24 @@ func AddImageMetaToRepoMeta(repoMeta *proto_go.RepoMeta, repoBlobs *proto_go.Rep
}
case ispec.MediaTypeImageIndex:
subBlobs := []string{}
lastUpdated := time.Time{}
for _, manifest := range imageMeta.Index.Manifests {
subBlobs = append(subBlobs, manifest.Digest.String())
blobInfo := repoBlobs.Blobs[manifest.Digest.String()]
if blobInfo != nil && blobInfo.LastUpdated != nil {
if lastUpdated.Before(blobInfo.LastUpdated.AsTime()) {
lastUpdated = blobInfo.LastUpdated.AsTime()
}
}
}
repoBlobs.Blobs[imageMeta.Digest.String()] = &proto_go.BlobInfo{
Size: imageMeta.Size,
SubBlobs: subBlobs,
Size: imageMeta.Size,
SubBlobs: subBlobs,
LastUpdated: mConvert.GetProtoTime(&lastUpdated),
}
}