react icon indicating copy to clipboard operation
react copied to clipboard

CI: try to make caching more reliable

Open kassens opened this issue 3 years ago • 1 comments

  • ~/.yarn/cache is now restored from an hierarchical cache key, if no precise match is found, we fallback to less precise ones.
  • The yarn install in fixtures/dom is also cached. Notably, is utilizes the cache from root, but stores into its more precise key.
  • Steps running in root no longer have a yarn install and rely on the cache from the setup step. I think this is something we should keep an eye on if these caches can be missed. If so, we might want to do yarn installs in each job, but then should also restore the yarn cache there. Yarn installs w/o cache restoration need to be avoided.

kassens avatar Sep 13 '22 21:09 kassens

So something is still missing here. I'll keep investigating.

kassens avatar Sep 13 '22 22:09 kassens

I have 2 working configurations now:

  • yarn install everywhere, no more caching of node_modules. This simplifies the config and makes it more robust. sample run
  • Cache node_modules including the node_modules in each package. This avoids the yarn install which takes about 30s per step, but it's a bit fragile as it lists out all the node_module directories for each package. I also think there's a possibility of a cache injection by a malicious PR, so I included the epoch in the key to give every build its own cache. sample run

kassens avatar Sep 14 '22 14:09 kassens

I'd prefer option 2 as 30s increases the feedback loop by 50% for most of the tests.

rickhanlonii avatar Sep 14 '22 15:09 rickhanlonii

@kassens An additional thing we could try is to retry the yarn install command if we see one of those 503 errors, which could still happen despite caching.

We could also try to see if caching is working with running the subsequent yarn install commands with the --offline flag which I think will error if it has to reach out to the network. If there are then maybe we need to make the initial setup job actually install all the packages.

poteto avatar Sep 14 '22 15:09 poteto

@poteto if we remove the yarn installs from all subsequent steps and rely on node_modules caching, I don't think we need the offline flag. I do like the idea of adding a retry though for the yarn install at the very beginning. I'll add that here too.

kassens avatar Sep 14 '22 15:09 kassens

I think this is finally ready for review!

kassens avatar Sep 14 '22 16:09 kassens