Skip to content

Allow to push finalized layers to the registry during build #18642

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

Open
StarpTech opened this issue May 20, 2023 · 6 comments
Open

Allow to push finalized layers to the registry during build #18642

StarpTech opened this issue May 20, 2023 · 6 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@StarpTech
Copy link

StarpTech commented May 20, 2023

Feature request description

Hi, building an image is a synchronous task and network is slow. I'm curious if it would be possible to build and push layers to the registry simultaneously. If possible, I think this can save a lot of time because while layer 2 is built, layer 1 can be pushed already to the registry.

Suggest potential solution

podman build --layers --push --format v2s2 -t gcr.io/myrepo/myimage
@StarpTech StarpTech added the kind/feature Categorizes issue or PR as related to a new feature. label May 20, 2023
@StarpTech StarpTech changed the title Question: What prevents podman to push layers to the registry during build? Allow to push finalized layers to the registry during build May 20, 2023
@mtrmac
Copy link
Collaborator

mtrmac commented May 22, 2023

This is interesting but also not something we are currently set up to do. c/image only provides an API to copy (“push”) completed images, not layers of unfinished images. And pushing a complete image to a registry requires choosing a tag.

It would probably be possible to hack something together (choose a random long tag, hope that there is no collision; delete the tag afterwards), but that seems fairly messy. Pushing just the layers as they are built would need to be a new API in c/image/copy, only for transports that opt in (like docker:// could).

@StarpTech
Copy link
Author

StarpTech commented May 27, 2023

Naively, it can be implemented very similarly to how --cache-from and --cache-to is working with the important difference that constructing and pushing the intermediate layers isn't a blocking operation.

I experienced very slow builds when using podman distributed cache feature. Although layers are cached Using cache .. the layer was pushed again to the registry. In the end, it took more time or similar time to build the image without the cache but this is a story for another issue.

@mtrmac
Copy link
Collaborator

mtrmac commented May 29, 2023

Yeah, --cache-to is adding a tag to the repo, for each image pushed. So that would be user-visible.

@StarpTech
Copy link
Author

StarpTech commented May 29, 2023

How hard would it be to implement this, as described in #18642 (comment) ? Is there public interest? If someone assists me, I can try to prepare a PR. I think the work has to be done in buildah.

Ref:

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 28, 2023

@flouthoc could you help @StarpTech

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants