jib icon indicating copy to clipboard operation
jib copied to clipboard

Feature Request: Pull and Retag Images From One Environment to Another.

Open andrewpolemeni opened this issue 2 years ago • 3 comments

Dear Jib Team,

I would like to suggest a feature that allows users to retag images based on the Jib configuration. The idea is to avoid rebuilding the images from scratch, and instead provide the ability to pull an existing image, retag it, and push it to another registry. This feature would be extremely useful for promoting images from one environment to another, as Jib already performs most of the necessary steps.

andrewpolemeni avatar Aug 07 '23 19:08 andrewpolemeni

Your goal sounds like copying an image in one registry to another. How about using a took like crane? Specifically, I think the command in this case is crane copy.

chanseokoh avatar Aug 07 '23 19:08 chanseokoh

Well I have a multie module repo so I would need to do it to all of them at once and Gradle is the a great way to accomplish this since I can run the task in parallel. Unless crane can do every image specified from a list? If so an example would be great.

andrewpolemeni avatar Aug 07 '23 21:08 andrewpolemeni

You can do this right now with something like

val from = RegistryImage.named(src)
val to = RegistryImage.named(dest)
Jib.from(from).containerize(Containerizer.to(to))

The problem is this downloads the entire image to Jib's cache and does not clean up afterwords. You can set a custom cache dir and clean up yourself, but that adds complexity and still downloads the entire source image before pushing.

Ideally there would be an operation that could copy layers from source to dest without needing to store them on disk. Or perhaps simply store one layer at a time in a temp file that is immediately cleaned up, if that is more efficient.

I would like this in Jib rather than using crane or skopeo because we have a Java Spring service that does this image copying process and I would like to keep everything in the JVM rather than calling an external process.

twarner-sofi avatar Jan 04 '24 19:01 twarner-sofi