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

image: Add convert command #4983

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

Conversation

vvoland
Copy link
Contributor

@vvoland vvoland commented Apr 4, 2024

Add docker image convert command

image

- Description for the changelog

- containerd image store: Add `docker image convert` command

Comment on lines 30 to 31
args.Src = posArgs[0]
args.Dst = posArgs[1]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change into flag arguments.

@vvoland vvoland force-pushed the c8d-multiplatform-convert branch 2 times, most recently from 54d1564 to 4b3b15f Compare May 16, 2024 15:09
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.

Project coverage is 61.23%. Comparing base (ce85b24) to head (d9775f8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4983      +/-   ##
==========================================
- Coverage   61.34%   61.23%   -0.11%     
==========================================
  Files         295      296       +1     
  Lines       20712    20751      +39     
==========================================
+ Hits        12705    12707       +2     
- Misses       7104     7142      +38     
+ Partials      903      902       -1     

@vvoland vvoland force-pushed the c8d-multiplatform-convert branch from e41109a to e09e6da Compare May 16, 2024 19:25
@neersighted neersighted added this to the v-future milestone May 24, 2024
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the c8d-multiplatform-convert branch from e09e6da to d9775f8 Compare June 4, 2024 10:27
flags.BoolVar(&args.NoAttestations, "no-attestations", false, "Do not include image attestations")
flags.BoolVar(&args.OnlyAvailablePlatforms, "available", false, "Only include platforms locally available to the daemon")
flags.StringArrayVar(&args.Dst, "to", nil, "Target image references")
flags.StringVar(&args.Src, "from", "", "Source image reference")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nerdctl already has nerdctl image convert SRC DST with a different purpose (akin to ctr images convert) :
https://github.com/containerd/nerdctl/blob/main/docs/command-reference.md#nerd_face-nerdctl-image-convert

Would it be possible to adopt the same syntax as nerdctl image convert SRC DST, or change the command name to avoid conflict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in general, the purpose is the same. Unfortunately I don't have any better idea for a name... Do you have any suggestions?

We deliberately chose the src and dst to be flag arguments instead of positional arguments as it gives more clarity, especially when multiple destinations might be specified.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should change our syntax (esp. since we settled on this one as the most user-friendly/better option) just for compatibility's sake.

Unless there's a more explicit/as clear name, I also don't think we should change the name to avoid "colliding" with nerdctls command, although I do understand the possible confusion if we have two commands with the same name/subcommand and different syntax.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We deliberately chose the src and dst to be flag arguments instead of positional arguments as it gives more clarity, especially when multiple destinations might be specified.

What about making it (docker|nerdctl) image convert SRC DST1 DST2 DST3, or (docker|nerdctl) image convert SRC DST1,DST2,DST3?

}

flags := cmd.Flags()
flags.StringArrayVar(&args.Platforms, "platforms", nil, "Include only the specified platforms in the destination image")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is named "platform" rather than "platforms" in nerdctl and ctr

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

Successfully merging this pull request may close these issues.

None yet

5 participants