imgpkg icon indicating copy to clipboard operation
imgpkg copied to clipboard

add command to copy bundle referenced images to registry where bundle already resides

Open cppforlife opened this issue 4 years ago • 7 comments

Describe the problem/challenge you have

  • i use dockerhub registry
  • i create bundle in my dockerhub account (that references images from all over the internet)
  • i dont want to "copy" my bundle to a different location just to ensure that referenced images are copied into my docherhub account

Describe the solution you'd like

currently one would have to do the following:

  • imgpkg push -b docker.io/dkalinin/foo:v1.0.0 -f my-bundle/
  • imgpkg copy -b docker.io/dkalinin/foo:v1.0.0 --to-repo docker.io/dkalinin/foo:v1.0.0-copied (not sure if i can just use same tag?)

this seems a bit repetitive. proposed steps:

  • imgpkg push -b docker.io/dkalinin/foo:v1.0.0 -f my-bundle/
  • imgpkg copy -b docker.io/dkalinin/foo:v1.0.0 --to-same-bundle (or may be a better name for the flag)

i think having an explicit flag like --to-same-bundle is good to avoid confusion of now specifying anything for other from-to pairs.

Anything else you would like to add:

this "promotes" the use case for ensuring i have all materials for the bundle in my registry to first class.

this might be also useful to "repair" bundle in your registry if some references images got deleted.

cppforlife avatar Dec 12 '20 16:12 cppforlife

I wonder if it makes more sense to have it as a flag on push, so user could just do something like: imgpkg push -b docker.io/... -f my-bundle --with-relocate

ewrenn8 avatar Dec 12 '20 17:12 ewrenn8

i was thinking about that, but id would prefer to keep push and copy distinct. seems like a good boundary to have.

cppforlife avatar Dec 12 '20 19:12 cppforlife

In this case, I tend to agree with @ewrenn8. Feels more natural that the operation you want to do when pushing your bundle is to concentrate the layers from a particular bundle under the same repository.

Also thinking about copy in itself not sure if the operation is the one we want to relocate the full bundle underneath a repository. Maybe we want a new operation called concentrate or centralize or condense not sure.

@cppforlife Did you come across a use case for this feature?

joaopapereira avatar Dec 14 '20 14:12 joaopapereira

Did you come across a use case for this feature?

described in "Describe the problem/challenge you have". wanna ensure that that my app doesnt depend on images outside of my registry so they dont break production if they disappear.

Feels more natural that the operation you want to do when pushing your bundle

possibly. though this might be useful after you pushed a bundle as well as a distinct step. eg what if you "forgot" to push with that flag. including a flag on push is a convenience feature, but we need to make sure we have "core" feature that's available standalone.

Maybe we want a new operation called concentrate or centralize or condense not sure.

i was thinking it's part of copy command because that's what happens when we copy bundle to a different registry. it just happens that in this case we are "copying" to the same location.

cppforlife avatar Dec 14 '20 21:12 cppforlife

My thought is that the flag makes sense for both the push and copy commands and should be consistent for both. I personally prefer --with-relocation. The flag would only work with pushing/copying a bundle. I would think push would be the more common use case though.

At the very least, I think we should accept the issue and discuss the UX further.

danielhelfand avatar Dec 17 '20 22:12 danielhelfand

--with-relocation

one note, we tried to avoid word relocation because we arent relocating anything (this is how we ended with "copy" word as a command).

cppforlife avatar Dec 18 '20 01:12 cppforlife

Comment from slack discussion on this issue:

(side note: now that we are also having dicsussions around copy config, im more convince that this should be a variation of copy command to avoid having to put all kinds of copy flags on push command)

This makes sense to me, since you are technically copying your config from your local directory to a repository along with the associated images.

voor avatar Apr 30 '21 00:04 voor