We recently moved from hosted to private agents, because of reasons that are not relevant to this question. The problem we're having now, is that the private agent runs out of disk space. I've checked why this is the case, and it turns out that for one of the workspaces the agent creates, the .git
folder grows to over 20Gb during the day, while the repository is only a few Gb. What can explain this excessive growth?
some extra info:
- We build from different branches, using the same pipeline (so it re-uses the same workspace)
- We do not clean the workspace between runs, since this would require is to re-get the entire repository each build, which slows the build. (I understand adding the clean option would solve our problem, but it would also slow down all builds, which we don't want)
- We used to use
fetchdepth: 1
in our pipelines, but we recently removed this, since it is no longer necessary on private agents, since the sources are cached between runs
Edit: to clarify, I'm looking for a way to avoid running out of disk space on the agents, without losing the ability to cache source files.