Created
September 27, 2017 21:02
-
-
Save ncdc/9d74e55c0613faf8ff1ea56c4d871e2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ helpers.go:41 @ func ParseDockerTimestamp(s string) (time.Time, error) { | |
// (`foo`), tag references (`foo:bar`), and manifest digest references | |
// (`foo@sha256:xyz`). | |
func matchImageTagOrSHA(inspected dockertypes.ImageInspect, image string) bool { | |
glog.Errorf("ANDY matchImageTagOrSHA, image=%s", image) | |
// The image string follows the grammar specified here | |
// https://github.com/docker/distribution/blob/master/reference/reference.go#L4 | |
named, err := dockerref.ParseNormalizedNamed(image) | |
@ helpers.go:62 @ func matchImageTagOrSHA(inspected dockertypes.ImageInspect, image string) bool { | |
// An image name (without the tag/digest) can be [hostname '/'] component ['/' component]* | |
// Because either the RepoTag or the name *may* contain the | |
// hostname or not, we only check for the suffix match. | |
if strings.HasSuffix(image, tag) || strings.HasSuffix(tag, image) { | |
glog.Errorf("ANDY image=%s, tag=%s", image, tag) | |
t, _ := dockerref.ParseNormalizedNamed(tag) | |
t2 := t.(dockerref.Tagged) | |
normalizedTag := t2.String() | |
glog.Errorf("ANDY image=%s, normalizedTag=%s", image, normalizedTag) | |
if strings.HasSuffix(image, normalizedTag) || strings.HasSuffix(normalizedTag, image) { | |
glog.Errorf("ANDY matched") | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment