Skip to content
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

feat: run and pull image completion from hub #5528

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Benehiko
Copy link
Member

@Benehiko Benehiko commented Oct 11, 2024

- 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 <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2024

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 <[email protected]>

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
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants