Skip to content

cache policy pull but push if not exists

We're using GitLab to build C++ projects that take quite some time to build from scratch. Using the cache feature helps but it takes quite a long time to package the files during the caching phase.

What I'd like to do is create something that creates a cache file the first time we build and keeps that cache around without updating it. The cache files are named by branch so createing a new branch causes a long first compile step but then all subsequent compiles can be fairly quick as it's not a common use case that the branch changes many files often that cause big recompiles.

After I have my first cache I can mod the gitlabci files to do cache: policy: pull but I'd rather not mod the .gitlab-ci files for that.