Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions util/imagetools/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import (
"golang.org/x/sync/errgroup"
)

const (
annotationReference = "vnd.docker.reference.digest"
var (
annotationReferences = []string{
"com.docker.reference.digest",
"vnd.docker.reference.digest", // TODO: deprecate/remove after migration to new annotation
}
)

type contentCache interface {
Expand Down Expand Up @@ -167,16 +170,24 @@ func (l *loader) fetch(ctx context.Context, fetcher remotes.Fetcher, desc ocispe
}
r.mu.Unlock()

ref, ok := desc.Annotations[annotationReference]
if ok {
found := false
for _, annotationReference := range annotationReferences {
ref, ok := desc.Annotations[annotationReference]
if !ok {
continue
}

refdgst, err := digest.Parse(ref)
if err != nil {
return err
}
r.mu.Lock()
r.refs[refdgst] = append(r.refs[refdgst], desc.Digest)
r.mu.Unlock()
} else {
found = true
break
}
if !found {
p := desc.Platform
if p == nil {
p, err = l.readPlatformFromConfig(ctx, fetcher, mfst.Config)
Expand Down