-
Notifications
You must be signed in to change notification settings - Fork 788
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
Adds "docker-list-tags" command to list tags #716
Conversation
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.
Thanks! This is pretty good.
Thanks for the super fast response. Will review and make changes as recommended. |
Need bash completions. |
@rhatdan yes, as discussed in the issue, I don't really care about the name. The contention seems to be with others' opinions on naming scope. I'm happy to use 'list-tags', 'list-registry-tags', 'list-repository-tags', or whatever as long as its descriptive of what the command does. How about 'list-repository-tags'? @mtrmac is that ok? I'd prefer not to make the change more than once, so if we can get agreement here first then I'll change it. Thanks again. I very much appreciate the prompt reviews and suggestions. |
Well, the thing is: Are you willing to bet that no new protocols and server kinds which could use a “list tags” operation will be added during the lifetime of Skopeo? Considering the long discussions about file-at-a-time sync, I’m really not. And if there are going to be new protocols and server kinds, then the CLI will need to accommodate them. If we don’t add the protocol anywhere in the CLI now, we’ll end up requiring an extra option, or a non-trivial command name, in the future, for the new protocols/server kinds. If Being explicit about the protocol now allows us to symmetrically handle future protocols without expressing a preference (who knows, the next one may well turn out to be a vendor-named one as well). Also, note that this command is pretty likely to be primarily used in scripts / automation. So, in a sense, the user-friendliness does not matter nearly as much as stable behavior. (So, I’m absolutely unwilling to do, or design this to eventually require, heuristic guessing about the protocol in Skopeo — we can’t know that it will be possible to safely guess that with future unknown protocols anyway.) (And, as far as user-friendliness goes, with completions, If Podman wants to provide easier-to-type code with more heuristics, it can of course do that; looking at how the semantics of the currently-existing heuristics in there turned out to be unclear and inconsistent, I wouldn’t recommend it but I can’t and won’t try to stop it.)
I’m not happy about that name but I guess I could settle on that if @rhatdan can; it’s still very generic, but at least I can console myself with the thought that calling image servers “registries” does not make any semantic sense, so at least there’s some chance that the new protocol won’t use this jargon and we won’t collide. |
I am not tighing the list-tags to only container-registries. If other containers stores supported tags, then list-tags should show there as well. I could see skopeo list-tags listing tags for an images stored in container-storage and docker-daemon. Perhaps. The question you raise is do I see some time in the future where list-tags would talk about something totally different on a a different type of image store, and my answer would be no. |
Then the CLI must be explicit about which “container store” the user is asking about. |
Yes I agree, the container store needs to be specified. |
As in: I'm fixing up integration tests now, and will get the updates pushed here shortly |
So, if the semantics of the parameter here is different, I think it should use a different syntax, maybe |
Why is the additional option needed?
|
@zhill @mtrmac @vrothberg What is the state of this PR? |
I have pushed updates and am ready for more feedback re:naming. I had let it sit for a while b/c my cycles to operate on feedback were limited. I'd like to get a clear direction on what to name the command and how params should work if not the way it is currently implemented. I can then rebase and get the PR ready to merge |
@rhatdan From my POV this is now mostly up to you to state goals and/or ask ask for a design, and if both, to make them consistent with each other. E.g. #716 (comment) asks a question that I think answered in the immediately preceding comment already. Or maybe just say that you are fine with |
Thanks, I'll get the updates done ASAP, but cycles are scarce until the end of the week. I appreciate your time reviewing and helping move this forward. |
af52650
to
07ee608
Compare
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 guess the discussion period was long enough. Last chance to object to skopeo list-repository-tags $docker-reference
.
(@vrothberg WDYT?)
These two are still outstanding:
#716 (comment)
#716 (comment)
that, and the mis-placed Error marshalling json output
error are the only things I care somewhat strongly enough; the rest are very low-priority and non-blocking.
Thanks for the review (again). I'll get updates in today. I've been very cycle constrained lately but have time to focus on this and get it over the finish line. Thanks! |
Thanks for the ping! I will have a look at this PR tomorrow morning with a fresh pair of eyes. |
@zhill, can you also rebase the PR so we can merge it more easily? |
Yes, working on that now. I'll rebase and squash it down to a single commit now that we're close (didn't want to lose history previously). Thanks again folks! I know its been a long PR due to my intermittent availability, the patience is appreciated. |
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.
Just a couple of nits mainly related to naming
cmd/skopeo/tags.go
Outdated
} | ||
|
||
return cli.Command{ | ||
Name: "list-repository-tags", |
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 have a preference to name the command list-tags
and require the input to follow transport:....
convention. Maybe we want to support something similar for other transports in the future. Embedding "repository" into the command name and making it docker-transport only would close that door in some way.
The code wouldn't need to change much as we can error out for other transports for now. But I am late to the game and may miss context.
@mtrmac WDYT?
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.
My worry is that it’s not certain that things can be generalized for all transports.
It’s already a bit conceptually dubious with docker://
, where docker://foo
means “the docker://foo:latest
image”, not “the docker://foo
repository”.
In general, the whole idea of “repository” and “tag” does generalize at all well — compare #716 (comment) (besides syntax problems) suggesting that the whole local storage is a single “repository” and the hostname/[ns/…/]repo:tag value is a “tag”: it’s not at all an unreasonable position to take, but it makes the concept of “tag” meaningless and rules out the possibility of any transport-agnostic consumer of the output of this command.
(Compare #682 (comment) and #524 (comment) dealing with registry names, all of this ends up with several docker://
syntaxes with different meanings and rules.)
My default heuristic in such cases is to intentionally make the command extremely specific and limited; if we ever generalize it, we can easily add a general command, and maintain the specific one as a trivial shim. Going the other way from a prematurely-general interface to a specific one, or changing the prematurely-general interface to be general in a different way, requires better ability to forecast the future.
But, overall, sure:
list-tags docker://…
andlist-docker-tags …
are equivalent in the information that is being provided- The “
docker://repo
means:latest
” quibble is pedantic but does not make a difference in practice (apart from our ability to cleanly reject tagged/digested input, but this PR does not reject it anyway) list-repository-tags …
is already an specifics-losing compromise that I’m not at all strongly attached to
As long as the input is clearly namespaced and therefore unambiguous (i.e. not skopeo list heuristically-guess-what-I-mean
), I think any of the three options works, and we’ve taken 4 months to decide and it’s not going to get any easier with 4 more months.
@vrothberg So, to settle this once for all, skopeo list-tags docker://…
?
I've made the changes and rebased along with squashing to a single commit for easier review and merge. |
cmd/skopeo/tags.go
Outdated
} | ||
|
||
return cli.Command{ | ||
Name: "list-repository-tags", |
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.
My worry is that it’s not certain that things can be generalized for all transports.
It’s already a bit conceptually dubious with docker://
, where docker://foo
means “the docker://foo:latest
image”, not “the docker://foo
repository”.
In general, the whole idea of “repository” and “tag” does generalize at all well — compare #716 (comment) (besides syntax problems) suggesting that the whole local storage is a single “repository” and the hostname/[ns/…/]repo:tag value is a “tag”: it’s not at all an unreasonable position to take, but it makes the concept of “tag” meaningless and rules out the possibility of any transport-agnostic consumer of the output of this command.
(Compare #682 (comment) and #524 (comment) dealing with registry names, all of this ends up with several docker://
syntaxes with different meanings and rules.)
My default heuristic in such cases is to intentionally make the command extremely specific and limited; if we ever generalize it, we can easily add a general command, and maintain the specific one as a trivial shim. Going the other way from a prematurely-general interface to a specific one, or changing the prematurely-general interface to be general in a different way, requires better ability to forecast the future.
But, overall, sure:
list-tags docker://…
andlist-docker-tags …
are equivalent in the information that is being provided- The “
docker://repo
means:latest
” quibble is pedantic but does not make a difference in practice (apart from our ability to cleanly reject tagged/digested input, but this PR does not reject it anyway) list-repository-tags …
is already an specifics-losing compromise that I’m not at all strongly attached to
As long as the input is clearly namespaced and therefore unambiguous (i.e. not skopeo list heuristically-guess-what-I-mean
), I think any of the three options works, and we’ve taken 4 months to decide and it’s not going to get any easier with 4 more months.
@vrothberg So, to settle this once for all, skopeo list-tags docker://…
?
Once the naming decision is made I'll update with a new commit for that change. Thanks @mtrmac and @vrothberg ! |
Ay! I am in favor of that. Thanks! |
I am also. |
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.
Thanks! A few comments after a quick skim, I’ll do a complete review later.
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.
A full review now.
apologies for going dark, some other stuff has come up but I'll get to this ASAP. I don't see any issues with making the suggested changes and I'll get those in as soon as I can but may be few more days. |
containers#276 Example: skopeo list-tags docker://docker.io/library/centos Returns response: { Repository": "docker.io/library/centos", "Tags": [ "6", "7", ... ] } Signed-off-by: Zach Hill <[email protected]>
Signed-off-by: Zach Hill <[email protected]>
Signed-off-by: Zach Hill <[email protected]>
Signed-off-by: Zach Hill <[email protected]>
…t already tested by the upstream container/images repo or local unit tests Signed-off-by: Zach Hill <[email protected]>
Signed-off-by: Zach Hill <[email protected]>
I'll update the branch to latest, but I think I resolved all the comments. Note that I did remove the integration test since there wasn't one for the |
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.
Thanks! Sorry it took so long.
Note that I did remove the integration test since there wasn't one for the inspect command and such a test was dependent on an external registry and didn't really provide a lot of value that was't covered by the unit tests. I can add it back in if you feel it provides real test value moving forward.
If you don’t think a test would be useful enough to keep this code working that it’s worth the trouble, sure, up to you.
Adds new command
docker-list-tags
to list the tags in a docker V2 registry's repository.Discussion in #276. I expect some changes will be needed in the naming so opening this early to facilitate discussion.
If there is any additional testing or docs required I will gladly update.