Closed dotansimha closed 2 years ago
This can be achieved with the new CacheBeta
pipeline task. It works by running a cache step before the yarn install, which restores / caches the global .yarn cache. So the yarn install still runs, but much faster due to having a pre-primed cache.
https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops#yarn
I haven’t had the time to go through the new caching feature. Is there anything the yarn task could do to make it easier in your opinion?
Looks pretty straightforward to me.
Not really, it just worked right out of the box for me. I added the new CacheBeta task, copied the config from the docs, tweaked it around to fit my project, and was good to go. I guess it would have been easier if your yarn task just had a checkbox to enable and abstracted away CacheBeta :p
I am experiencing something very similar to https://stackoverflow.com/questions/64325825/yarn-module-not-found-error-in-azure-pipelines-via-cache-mechanism. Any ideas on how to troubleshoot this?
Are you reporting a bug or a feature request ?
Description
I was wondering if it's possible to add support for caching
node_modules
according to a hash of eitherpackage.json
oryarn.lock
. It could make the builds much faster.Expected behavior
After each sucussful build, add a build task for caching
node_modules
, and save it with a key created by a hash ofpackage.json
oryarn.lock
. When build starts, it should hash it again and look in the cache for a matching file, untar it, and then runyarn install
.CircleCI has a similar solution that could be integrated with Yarn:
System information
VSTS or TFS:
Agent:
OS: