feat: switch from GitLab caching to Registry caching for docker builds
Looking for performance improvements, this switches from GitLab CI tasks to registry cache provider.
Using native image caches is likely to be faster: see https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/instrumentor/-/merge_requests/4314 for real-world results.
@jburnitz reported 15-20 minutes just to push and pull files from the cache using GitLab caching: https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/instrumentor/-/jobs/8199915708#L909
Caching
By default, caching is enabled for Docker tasks.
Caching will store cache images in the $CI_REGISTRY_IMAGE/cache registry.
All cache tags start with the prefix of cache- to allow for easy cleanup.
Two cache key schemes are used:
-
BRANCH_REGISTRY_CACHE_KEYfor branches -
DEFAULT_BRANCH_REGISTRY_CACHE_KEY- for default branch.
Please review the template definition for details, but these can be overridden depending on project requirements.
There are three caching modes:
-
For branches:
docker buildxwill read from the branch cache and the default branch cache, and write the branch cache. -
For main branch:
docker buildxwill read from and write to the default branch cache. -
For tags:
docker buildxwill read from the default branch cache and not write to the cache.
cc @jburnitz