title: Azure DevOps - Clean build directory
body: <p>Just to mention I am using a self-hosted agent for running my build and release pipelines.</p>
  <p>The problem is when I run any build and it failed due to some issues in the pipeline. The cloned branch from remote sits in the _work directory. The second run also picks up the same work directory, and I have checked manually from the agent _work directory no new directory was cloned and I can also verify from Azure Pipeline logs they are using the same old directory.</p>
  <p>What I did temporarily to solve this, I went into the old directory(i.e. /home/user/_work/13) and manually delete that 13 directories then azure pick it up the new folder say 14 under _work, and I could see the latest cloned code from the remote.</p>
  <p>So how to automatically delete the work folder(agent build directory i.e. 13/14 under _work) in case of any failure happen.</p>
  <p>PS: I already have cleanup steps in place when my pipeline complete with success, which I run at the end. Also, I am writing .yml based pipelines.</p>
  <p>Please let me know if any information is required for a better understanding.</p>