getImageRef returns the image digest if exists, or else returns the image ID.
(client libdocker.DockerClientInterface, image string)
| 204 | |
| 205 | // getImageRef returns the image digest if exists, or else returns the image ID. |
| 206 | func getImageRef(client libdocker.DockerClientInterface, image string) (string, error) { |
| 207 | img, err := client.InspectImageByRef(image) |
| 208 | if err != nil { |
| 209 | return "", err |
| 210 | } |
| 211 | if img == nil { |
| 212 | return "", fmt.Errorf("unable to inspect image %s", image) |
| 213 | } |
| 214 | |
| 215 | // Returns the digest if it exist. |
| 216 | if len(img.RepoDigests) > 0 { |
| 217 | return img.RepoDigests[0], nil |
| 218 | } |
| 219 | |
| 220 | return img.ID, nil |
| 221 | } |
| 222 | |
| 223 | func filterHTTPError(err error, image string) error { |
| 224 | // docker/docker/pull/11314 prints detailed error info for docker pull. |
no test coverage detected
searching dependent graphs…