Skip to content

Fix yarn cache across pipelines

Giuseppe De Feo requested to merge fix/testing/yarn_cache into master

The prep_share_yarn_cache doesn't have sensible performance improvement using the cache, find out why.

The reasons are 3:

  • the ~/.cache/yarn doesn't exist instead is .yarn_cache/v6
  • the yarn.lock file is not used, so yarn does retrieve some packages from the internet (version bumps that happen due to yarn.lock not being present)
  • the previous step also means that the cache is ever so different, therefore the gitlab logic performs an upload even when the cache is fundamentally changed besides the version bumps this take 2/3 minutes

In my approach I had to leave behind the yarn.lock logic which will be implemented only when the private npm registry cache is used across the company systems (IDE/Runners)

What I did is to force the upload of the prep shared yarn cache to not be performed using a pull only policy for when there are no changes to the package.json files.

A further improvement is to leave the key to be dynamic so that the projects that don't use src/packages/blocks/core but use other cores can leverage the above improvements

The pipeline speed is now around 4/5 minutes when using cache depending on downloading speed compared to the 8/13 minutes of before (which was also always dependent on upload speeds)

Merge request reports