ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an OpenShift ImageReference.
(ref string)
| 57 | |
| 58 | // ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an OpenShift ImageReference. |
| 59 | func ParseReference(ref string) (types.ImageReference, error) { |
| 60 | r, err := reference.ParseNormalizedNamed(ref) |
| 61 | if err != nil { |
| 62 | return nil, fmt.Errorf("failed to parse image reference %q: %w", ref, err) |
| 63 | } |
| 64 | tagged, ok := r.(reference.NamedTagged) |
| 65 | if !ok { |
| 66 | return nil, fmt.Errorf("invalid image reference %s, expected format: 'hostname/namespace/stream:tag'", ref) |
| 67 | } |
| 68 | return NewReference(tagged) |
| 69 | } |
| 70 | |
| 71 | // NewReference returns an OpenShift reference for a reference.NamedTagged |
| 72 | func NewReference(dockerRef reference.NamedTagged) (types.ImageReference, error) { |
searching dependent graphs…