-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add bash completion for experimental CLI commands (manifest) #1252
Conversation
d3ed81f
to
bf0b79c
Compare
Codecov Report
@@ Coverage Diff @@
## master #1252 +/- ##
=======================================
Coverage 54.73% 54.73%
=======================================
Files 292 292
Lines 19267 19267
=======================================
Hits 10545 10545
Misses 8063 8063
Partials 659 659 |
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.
SGTM 🎍
@vdemeester It's still very basic with regard of the arguments. I don't know what are valid values for MANIFEST_LIST and MANIFEST:
So I do not complete anything right now, allowing any string. |
@vdemeester Do you know who I might ask for help? |
cc @clnperez @estesp @thaJeztah 👼 |
c18b5de
to
8f434cb
Compare
@albers is there a check done for image names anywhere? the same rules apply (though I admit I don't know much about how the bash-completion verification works). |
@clnperez So I can use an image name as a MANIFEST? $ docker manifest create alpine-list alpine:3.6 alpine:3.7 alpine:3.8
docker.io/library/alpine:3.6 is a manifest list Can you please give me a working example fo a |
There are some examples in the doc: https://docs.docker.com/engine/reference/commandline/manifest Your issue is that |
@clnperez I found the examples not very helpful because they are not working code. There seem to be some prerequistes required for the commands to work apart from pulling down images and pushing them to a local registry. $ docker pull busybox:1.29.2-uclibc
$ docker tag busybox:1.29.2-uclibc localhost:5000/albers/busybox:1.29.2-uclibc
$ docker push localhost:5000/albers/busybox:1.29.2-uclibc
$ docker manifest create localhost:5000/albers/busybox:1.29.2 localhost:5000/albers/busybox:1.29.2-uclibc
no such manifest: localhost:5000/albers/busybox:1.29.2-uclibc It's very hard to figure this out without understanding the relationship between images and manifests. |
8f434cb
to
6562929
Compare
three things:
|
6562929
to
4e4f8b2
Compare
@clnperez Thanks very much for pointing me to your blog. This was exactly what I needed to understand the feature. I was able to create, annotate and push manifest lists. |
I added completion for manifest lists.
As an approximation, I complete all images for both manifest lists and manifests. |
eb774e7
to
85baa0d
Compare
Added support for completion of This is now ready for review. |
@albers This sounds reasonable to me. I might ask that we put a comment into the file you pulled those os & arch values from and in your PR that mentions that we should keep them in sync. |
This preapares bash completion for more context sensitivity: - experimental cli features - orchestrator specific features Also renames _daemon_ to _server_ where used in context of `docker version` because the fields there are grouped unter _Server_. Signed-off-by: Harald Albers <[email protected]>
This is needed for implementing bash completion for the `docker manifest` command family. Signed-off-by: Harald Albers <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
85baa0d
to
0fb4256
Compare
@clnperez Done. |
@vdemeester @thaJeztah Thoughts on this one? |
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.
Still LGTM
Do we wait for #1355 to be merged ? |
@thaJeztah please review. |
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
sorry, thought I already LGTM'd this one 😅
This adds bash completion for
docker manifest
and its subcommands.Completion for the
manifest
command is only activated if experimental CLI features are enabled (either by setting"experimental": "enabled"
in .docker/config.json or the env varDOCKER_CLI_EXPERIMENTAL=enabled
). This configuration setting is harvested from the output ofdocker version
.Before adding the third configuration setting that is extracted from
docker version
's output , I refactored the existing logic to a more consistent and clearer state. There is only one call todocker version
. It is executed lazily and caches its result.Note: The initial concept also included gathering the orchestrator in this step, but this piece of information went bananas in #1137.
In the context of
docker version
and its output, I changed the domain language to use server instead of daemon because this is the term used there (bounded context). daemon is better suited for local calls whereas server is more appropriate for (potentially) remote calls.Edit: The list of valid os/arch values was taken from
validOSArches
in util.go. A comment was left as a reminder to keep both files in sync.