Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTS Hosted Agent, not enough space in the disk

I cannot build in VSTS with hosted agent (VS 2017) with error:

System.IO.IOException: There is not enough space on the disk

I have tried setting "Clean" option to true on Build , Repository definition without solving the issue. I didn't have this option set to true which I imagine led to the current situation.

Also installed VSTS extension "Clean Agent Directories" and added as last step of the build process without solving the issue either.

Is there an option that would allow me to solve this issue and continue using the hosted build agent ?

like image 903
donquijote Avatar asked Sep 10 '17 13:09

donquijote


2 Answers

Hosted agents offer 10 GB of space. You stated that your entire solution folder is 2.6 GB. Your build outputs will typically be somewhere in the range of 2x that size, if not larger, depending on various factors.

If you're a Git user, this the entire repo that's being cloned may be significantly larger than 2.6 GB, as well -- cloning the repo brings down not only the current working copy of the code, but also all of the history.

You can control the clone depth (e.g. how much history is pulled down) by enabling Shallow fetch under the Advanced options of your repo settings.

If you're a TFVC user, you can check your workspace mappings to ensure only relevant source code is being pulled down.

You may be in a situation where the 10 GB simply isn't sufficient for your purposes. If the 2.6 GB is purely code and contains no binary assets (images, PDFs, video files, etc), you may want to start modularizing your application so smaller subsections can be built and independently deployed. If the 2.6 GB contains a lot of binary assets, you'll likely want to separate static content (images, et al) from source code and devise a separate static content deployment process.

like image 140
Daniel Mann Avatar answered Nov 20 '22 12:11

Daniel Mann


According to Microsoft's documentation,

(Microsoft-hosted agents) Provide at least 10 GB of storage for your source and build outputs.

So, if you are getting "not enough space in disk error" it might mean that the amount of disk space used by your source code (files, repos, branches, etc), together with the amount of disk space taken by your build output (files generated as a result of the build process) is crossing the 10 GB of storaged provided by your DevOps plan.

When getting this error I had to delete an old git repo and an old git branch, getting 17 MB of free space, which was enough for my build to process. Thus, in my case the space was being used up by source code. It could well be too many or too big files being generated by the build. That is, you just need to find out which one of these two is the cause of your lack of disk space, and work on freeing it.

like image 32
Ulysses Alves Avatar answered Nov 20 '22 12:11

Ulysses Alves