ResolveName resolves the specified name. If the name resolves to a local image, the fully resolved name will be returned. Otherwise, the name will be properly normalized. Note that an empty string is returned as is.
(name string)
| 458 | // |
| 459 | // Note that an empty string is returned as is. |
| 460 | func (r *Runtime) ResolveName(name string) (string, error) { |
| 461 | if name == "" { |
| 462 | return "", nil |
| 463 | } |
| 464 | image, resolvedName, err := r.LookupImage(name, nil) |
| 465 | if err != nil && errors.Cause(err) != storage.ErrImageUnknown { |
| 466 | return "", err |
| 467 | } |
| 468 | |
| 469 | if image != nil && !strings.HasPrefix(image.ID(), resolvedName) { |
| 470 | return resolvedName, err |
| 471 | } |
| 472 | |
| 473 | normalized, err := NormalizeName(name) |
| 474 | if err != nil { |
| 475 | return "", err |
| 476 | } |
| 477 | |
| 478 | return normalized.String(), nil |
| 479 | } |
| 480 | |
| 481 | // imageReferenceMatchesContext return true if the specified reference matches |
| 482 | // the platform (os, arch, variant) as specified by the lookup options. |
nothing calls this directly
no test coverage detected