-
Notifications
You must be signed in to change notification settings - Fork 456
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
handle empty RepoTags for ListImage #156
Conversation
cfb3109
to
8e87a59
Compare
@@ -125,11 +125,7 @@ var listImageCommand = cli.Command{ | |||
printHeader = false | |||
fmt.Fprintln(w, "IMAGE\tTAG\tIMAGE ID\tSIZE") | |||
} | |||
repoTags := "<none>" | |||
if image.RepoTags != nil { |
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 should change this to if len(image.RepoTags) > 0
.
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.
Only this is insufficient. repoTagsPair[1] will still cause panic when it is "" or "tag1"
cmd/crictl/image.go
Outdated
@@ -270,6 +266,21 @@ func getAuth(creds string) (*pb.AuthConfig, error) { | |||
}, nil | |||
} | |||
|
|||
// Support these cases as below: |
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.
I think it's fine to assume that this should always be image:tag
or image:digest
.
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.
Sorry, what do you mean?
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.
I think if the repotag is not image:tag
, we could log an error. Ideally repo tag should always be image: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.
Do you mean the cri-containerd or docker-shim should return "image:tag"?
In any case crictl should not panic. Crictl need to protect self.
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.
@yanxuean In which case repoTags will be :tag2
or tag1:
?
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.
I don't know :)
I only protect self.
/retest |
Who can tell me how trigger a new test? I need to do it when the reason of fail checking is not belong to me. |
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.
The code LGTM.
The only problem is that I'm not sure whether and how we should display image without repotag. How does docker handle it today?
cmd/crictl/image.go
Outdated
repoTags = image.RepoTags[0] | ||
} | ||
repoTagsPair := strings.Split(repoTags, ":") | ||
repoTagsPair := parseRepoTagPair(image.RepoTags) |
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.
normalizeRepoTagPair.
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.
The name is perfect.
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.
done
docker image for image pulled by repoDigest
|
For image which only has repo digest, we should:
I'm fine with adding |
+1. @yanxuean Could you add this in this PR? |
I am adding it. :) |
fix kubernetes-sigs#155 list all image tags. fix kubernetes-sigs#157 Signed-off-by: yanxuean <[email protected]>
@Random-Liu @feiskyer PTAL |
Also find a bug in dockershim, see kubernetes/kubernetes#54122 |
@feiskyer Tks |
fix #155
Signed-off-by: yanxuean [email protected]