azureazure-devopsazure-pipelinesazure-devops-self-hosted-agentazure-agent

Reducing Storage Usage of Azure Self-Hosted Agent on Server: How to Free Up Space?


I have installed my Azure self-hosted agent on a server that is consuming a lot of space.
The '_work' folder is taking up the most space, and within this folder, we have the following subfolders: enter image description here

1)How can I reduce that space on the server?
2)What is the purpose of these folders?
3)Can we increase space by deleting some of these folders, and what potential issues might arise if we delete them?


Solution

  • You can enable cleaning workspace in the pipeline. It will clean directory next time the one for given job is picked up

      - job: myJob
        workspace:
          clean: outputs | resources | all # what to clean up before the job
    

    It will not clean all of this above.

    For that you please enable maintenance job

    You can configure agent pools to periodically clean stale working directories and repositories. This should reduce the potential for the agents to run out of disk space. Maintenance jobs are configured at the project collection or organisation level in agent pool settings.

    These directories contains source code, compiled code etc. This specific directories are just working directories for you jobs.

    ANd yes you can delete them manually. Nothing bad will happen. Next time job will download all what is needed to performs steps.