Skip to content
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

Merged

Conversation

mfojtik
Copy link
Contributor

@mfojtik mfojtik commented Feb 23, 2017

@mfojtik mfojtik added this to the 1.5.0 milestone Feb 23, 2017
@mfojtik mfojtik changed the title Bug 1422376: Fix resolving ImageStreamImage latest tag [3.5] Bug 1422376: Fix resolving ImageStreamImage latest tag Feb 23, 2017
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) {
Copy link

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?

Copy link
Contributor Author

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.

Copy link

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()

Copy link
Contributor Author

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 :-)

@@ -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")
Copy link

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?

Copy link

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry, debugging left over.

@pweil-
Copy link

pweil- commented Feb 23, 2017

@legionus @miminar @soltysh

@pweil-
Copy link

pweil- commented Feb 23, 2017

also per our retro discussion...where dem tests at?

@mfojtik
Copy link
Contributor Author

mfojtik commented Feb 23, 2017

@pweil- there is a TestDockerImageReferenceForImage, but you're right, I should add the non-sha256 format there to make sure both works.

@mfojtik mfojtik force-pushed the fix_latest_image_tagevent_35 branch 2 times, most recently from a2bf080 to df5d176 Compare February 23, 2017 19:57
@mfojtik
Copy link
Contributor Author

mfojtik commented Feb 23, 2017

@pweil- now with test and helper :-)

@mfojtik
Copy link
Contributor Author

mfojtik commented Feb 23, 2017

[test]

@pweil-
Copy link

pweil- commented Feb 23, 2017

LGTM

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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))) {
Copy link
Contributor

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 😨

Copy link

@pweil- pweil- Feb 23, 2017

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))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup.

Copy link
Contributor Author

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...

Copy link
Contributor Author

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?

@mfojtik mfojtik force-pushed the fix_latest_image_tagevent_35 branch from df5d176 to 232330d Compare February 23, 2017 21:40
@mfojtik
Copy link
Contributor Author

mfojtik commented Feb 23, 2017

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 232330d

@openshift-bot
Copy link
Contributor

openshift-bot commented Feb 23, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/520/) (Image: devenv-rhel7_5970)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 232330d

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_future/520/) (Base Commit: 4a74666)

@openshift-bot openshift-bot merged commit 42bdc43 into openshift:release-1.5 Feb 24, 2017
@mfojtik mfojtik deleted the fix_latest_image_tagevent_35 branch September 5, 2018 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants