MCPcopy
hub / github.com/containerd/containerd / ParseImageReferences

Function ParseImageReferences

internal/cri/util/references.go:26–40  ·  view source on GitHub ↗

ParseImageReferences parses a list of arbitrary image references and returns the repotags and repodigests

(refs []string)

Source from the content-addressed store, hash-verified

24// ParseImageReferences parses a list of arbitrary image references and returns
25// the repotags and repodigests
26func ParseImageReferences(refs []string) ([]string, []string) {
27 var tags, digests []string
28 for _, ref := range refs {
29 parsed, err := reference.ParseAnyReference(ref)
30 if err != nil {
31 continue
32 }
33 if _, ok := parsed.(reference.Canonical); ok {
34 digests = append(digests, parsed.String())
35 } else if _, ok := parsed.(reference.Tagged); ok {
36 tags = append(tags, parsed.String())
37 }
38 }
39 return tags, digests
40}
41
42// GetRepoDigestAndTag returns image repoDigest and repoTag of the named image reference.
43func GetRepoDigestAndTag(namedRef reference.Named, digest imagedigest.Digest) (string, string) {

Callers 3

ContainerStatusMethod · 0.92
toCRIImageFunction · 0.92
TestParseImageReferencesFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by 1

TestParseImageReferencesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…