ParseImageReferences parses a list of arbitrary image references and returns the repotags and repodigests
(refs []string)
| 24 | // ParseImageReferences parses a list of arbitrary image references and returns |
| 25 | // the repotags and repodigests |
| 26 | func 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. |
| 43 | func GetRepoDigestAndTag(namedRef reference.Named, digest imagedigest.Digest) (string, string) { |
searching dependent graphs…