Investigate the ideal way to cache
There's a number of caching issues lately, and I would like to figure out an ideal way and unify our caching strategy. I'll fill the references and context over time.
Background and context
[To be filled...]
Proposed solutions
- We update the cache (pull-push) only on master pipeline. We can do this via the scheduled master pipeline, so we can dodge #209864 (closed)
- In merge requests, we only pull the cache (pull).
- The cache can be using a fixed key, so merge requests will all pull cache from master.
- We need to find a way to expire older packages cached in the cache. For
gemswe may be usingbundle install --cleanso it'll remove packages we're not using. However, we cannot do this if we're mergingvendor/rubyandvendor/gitaly-ruby, because otherwise it'll remove packages from the otherGemfile.lock. Or we may runbundle install --cleanforvendor/rubyfirst, and thenbundle installforvendor/gitaly-rubynext without--clean, so it'll not remove packages needed for GitLab Rails but not for Gitaly-ruby. - We need to find the same solution for
yarn installandnode_modules. - We need to find the same solution for
.go/pkg/modaw well
References
Edited by Lin Jen-Shin