B
BlueBuild2mo ago
iron

Build Cache for GitLab.com

I am currently using BlueBuild with a GitHub Action that utilizes the GitHub Actions (GHA) build cache. This feature significantly improves my build times, and I’m very pleased with the results. However, I am considering migrating my project to GitLab.com and have noticed that there doesn't seem to be a similar caching feature available on that platform. I believe it might be possible to implement a caching solution akin to the GHA cache using "Inline cache" or "Registry cache" for GitLab.com. Could anyone provide insights on whether such features are available or if there are plans to implement them in the future? Thank you for your assistance!
8 Replies
Luke Skywunker
Luke Skywunker2mo ago
That would be something that I would have to code up. I believe we've already got an issue for it.
Robert
Robert2w ago
With our project https://gitlab.com/eu-os/workspace-images/eu-os-base-demo we would also benefit from this caching. Buildah got recently the options --layers --cache-from … --cache-to. Man here: https://manpages.ubuntu.com/manpages/plucky/man1/buildah-build.1.html With Gitlab CI, this could look like: podman build -t container-name:$VERSION --layers --cache-to $CI_REGISTRY_IMAGE/cache-image --cache-from $CI_REGISTRY_IMAGE/cache-image -f Containerfile . The cache-image could possibly made configurable. @Luke Skywunker I did not find the issue in the cli repo. If you tell me where it is, I can also add this info to the issue (and track the issue myself). 🙂
Luke Skywunker
It looks like we don't have one. I can try to remember to make one later, or you can write it up
Luci
Luci2w ago
Could you share this cache stuff? I'd love to use it myself.
Robert
Robert2w ago
I have created this issue here: https://github.com/blue-build/cli/issues/410
GitHub
feat: support podman/buildah image cache to reach feature parity on...
Hi, following the discussion on Discord, I propose to add to blue-build options to use image caching also on other platforms than Github. One way to do this would be to expose existing caching feat...
Luke Skywunker
Cool, thanks for that!
iron
ironOP4d ago
I've been using a caching strategy similar to this example from the GitLab documentation in other projects, and it works great:
docker buildx build --push -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA \
--cache-to type=registry,ref=$CI_REGISTRY_IMAGE/cache-image,mode=max \
--cache-from type=registry,ref=$CI_REGISTRY_IMAGE/cache-image .
docker buildx build --push -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA \
--cache-to type=registry,ref=$CI_REGISTRY_IMAGE/cache-image,mode=max \
--cache-from type=registry,ref=$CI_REGISTRY_IMAGE/cache-image .
I think we should follow a similar approach to BB_BUILDKIT_CACHE_GHA to support this caching mechanism by adding another if statement in the build_tag_push function in docker_drivers.rs. What do you all think?
Luke Skywunker
Yeah that's the plan. Just haven't gotten to it

Did you find this page helpful?