Skip to content

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 gems we may be using bundle install --clean so it'll remove packages we're not using. However, we cannot do this if we're merging vendor/ruby and vendor/gitaly-ruby, because otherwise it'll remove packages from the other Gemfile.lock. Or we may run bundle install --clean for vendor/ruby first, and then bundle install for vendor/gitaly-ruby next 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 install and node_modules.
  • We need to find the same solution for .go/pkg/mod aw well

/cc @gl-quality/eng-prod

References

Edited by Lin Jen-Shin