Skip to content

feat: run and pull image completion from hub - #5528

Draft
Benehiko wants to merge 4 commits into
docker:masterfrom
Benehiko:hub-completions
Draft

feat: run and pull image completion from hub#5528
Benehiko wants to merge 4 commits into
docker:masterfrom
Benehiko:hub-completions

Conversation

@Benehiko

@Benehiko Benehiko commented Oct 11, 2024

Copy link
Copy Markdown
Member

- What I did
Cobra completions using the Docker Hub v3 image search API.
The API is proxied through the docker engine: moby/moby#48692

Completion of images when calling docker run/pull from local images and Docker Hub.

Allows for image search based on partial matches. Also allows image tag search when adding : after the image name.

image
image
image
image

- How I did it

- How to verify it
Setup completion file https://docs.docker.com/engine/cli/completion/
docker completion <fish|bash|zsh> > <completion file>

docker run [tab][tab]
docker run postg[tab][tab]
docker run postgres:[tab][tab]
docker run postgres:alpine[tab][tab]

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

image

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Oct 11, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 2.40964% with 81 lines in your changes missing coverage. Please review.

Project coverage is 60.47%. Comparing base (88f1e99) to head (5760a3d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5528      +/-   ##
==========================================
- Coverage   60.67%   60.47%   -0.21%     
==========================================
  Files         345      345              
  Lines       23488    23570      +82     
==========================================
+ Hits        14252    14253       +1     
- Misses       8263     8344      +81     
  Partials      973      973              
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Comment thread cli/command/completion/functions.go Outdated

req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
if err != nil {
logrus.Errorf("Error creating hub image tags request: %v", err)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I honestly don't know what the best way would be for us to track errors for the completions. Maybe we should write debug logs to a file?

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants