Repository navigation
pkg/operator/image.go: Adjust image path building - #3392
Merged
s-urbaniak merged 4 commits intoAug 11, 2020
Merged
Conversation
Contributor
|
Looks like we need to adapt some of the unit test expectations. What this PR does is how I expect image handling to work though, so fixing the unit test expectations is the right thing to do. |
Contributor
Author
|
Fixed the unit tests @brancz can you please have another look, thanks! |
s-urbaniak
reviewed
Aug 10, 2020
| if sha != "" { | ||
| image = fmt.Sprintf("%s@sha256:%s", baseImage, sha) | ||
| _, isTagged := named.(dockerref.Tagged) | ||
| _, isDigested := named.(dockerref.Digested) |
s-urbaniak
reviewed
Aug 10, 2020
| image = fmt.Sprintf("%s@sha256:%s", baseImage, sha) | ||
| _, isTagged := named.(dockerref.Tagged) | ||
| _, isDigested := named.(dockerref.Digested) | ||
| if !isTagged && !isDigested { |
Contributor
There was a problem hiding this comment.
nit: instead of having a big if block here, return early:
if isTagged || isDigested {
return image, nil
}
and unindent the complex if-else logic:
if sha != " { ...
} else if version != "" {
..
}
return image, nil
this makes the code more linear to read, wdyt?
Image can contain tag already, this checks if it does it just returns the image. Otherwise sha/digest takes priority over tag and lastly version is taken due to historic reasons.
lilic
force-pushed
the
fix-image-tag-version
branch
from
August 10, 2020 12:56
40b5cca to
7b4a9d7
Compare
Contributor
Author
|
@s-urbaniak addressed your comment, PTAL, thanks!! 🎉 |
Contributor
|
lgtm 🎉 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image can contain tag already, this checks if it does it just returns
the image. Otherwise sha/digest takes priority over tag and lastly
version is taken due to historic reasons.
cc @prometheus-operator/prometheus-operator-reviewers