https://youtu.be/9qljpi5jiMQ (13:58 time stamp for the part that is especially relevant here)
And Microsoft has effectively zero incentive to fix this because it still technically works and they get to charge my employer for all that extra build agent time. Here's a few examples of people reporting similar issues and getting zero help:
https://developercommunity.visualstudio.com/t/devops-build-p...
https://developercommunity.visualstudio.com/t/nuget-restore-...
https://developercommunity.visualstudio.com/t/slow-performan...
Unless you’re booting build servers on demand on your infra, you aren’t paying more for more minutes. Just waiting :(
(Unlike GitHub, where they do charge per minute.)
When I make an edit and rebuild on my computer, it takes a few seconds to rebuild because most things are cached.
In CI it takes 20 minutes on the MR branches of our repo. 30 minutes on master. Because a whole bunch of crap is downloaded from scratch and rebuilt from scratch.
Our infrastructure guys did set up something that is able to cache stuff that some of the repos use. But with the limited access I have I have not been able to figure out how to make use of it for the repo I work on. And they don’t have time to look into it for me either.
That’s my life lol
Still, on my local machine these jobs would take 5 mins so its not perfect. And as the build gets more complicated and more stages are added, the problem compounds since the initial download is the slowest part.
For github actions caching was fairly easy to add.
They also cache the Docker images without you having to do anything but it really only works if you use their base images. With custom images the cache rate doesn't look great in my experience but I have no stats to back that up.
For example:
The last run didn't clean up, or changed something global.
New runs don't work because some expected state is missing that had been set up on a previous run.
Blowing the agent away each time reduces the chance that something previously run can impact your current run.
This is at the cost of pulling from networks each time. You can reduce those issues by adding network caches for modules/dependencies.