-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.5] Bug 1422376: Fix resolving ImageStreamImage latest tag #13090
[3.5] Bug 1422376: Fix resolving ImageStreamImage latest tag #13090
Conversation
pkg/image/api/helper.go
Outdated
if event.Image != imageID { | ||
continue | ||
if d, err := digest.ParseDigest(event.Image); err == nil { | ||
if !strings.HasPrefix(d.Hex(), imageID) && !strings.HasPrefix(event.Image, imageID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use this same digest and event.Image
logic (and the item below) in the ResolveImageId
in this same file. Time for a helper method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if helper is possible... those two seems to have inverted logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what the !
is for 😄 DigestOrImageMatch()
vs !DigestOrImageMatch()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I gotcha and I was wrong :-)
pkg/image/api/helper.go
Outdated
@@ -642,8 +648,10 @@ func ResolveLatestTaggedImage(stream *ImageStream, tag string) (string, bool) { | |||
func DockerImageReferenceForImage(stream *ImageStream, imageID string) (string, bool) { | |||
tag, event := LatestImageTagEvent(stream, imageID) | |||
if len(tag) == 0 { | |||
glog.Infof("no tag") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these two log statements useful? Print out the stream and imageID maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, are they Info level or debugging level type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry, debugging left over.
also per our retro discussion...where dem tests at? |
@pweil- there is a |
a2bf080
to
df5d176
Compare
@pweil- now with test and helper :-) |
[test] |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/image/api/helper.go
Outdated
continue | ||
} | ||
if latestTagEvent == nil || (latestTagEvent != nil && event.Created.After(latestTagEvent.Created.Time)) { | ||
if digestOrImageMatch(event.Image, imageID) && (latestTagEvent == nil || (latestTagEvent != nil && event.Created.After(latestTagEvent.Created.Time))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition freaks me out 😨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be reduced to this, right?
if digestOrImageMatch(event.Image, imageID) &&
(latestTagEvent == nil || event.Created.After(latestTagEvent.Created.Time))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i'm a bracket guy...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pweil- if latestTagEvent is nil, then the right part will panic(), or i'm drunk?
df5d176
to
232330d
Compare
[merge] |
Evaluated for origin test up to 232330d |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/520/) (Image: devenv-rhel7_5970) |
Evaluated for origin merge up to 232330d |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/520/) (Base Commit: 4a74666) |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1422376
Master: #13089