title: How stop Azure Pipeline Self-Hosted agent to delete sources
body: <p>I have an Azure Pipeline Self-Hosted agent (Windows) I configured on one of my laptops, so everything is persistent; the pipeline that uses that, clones the repository, then runs a CMake configure which further downloads several submodules through <code>git submodule update --init</code>.</p>
  
  <p>Although I think I configured the pipeline in any way I could to only clean outputs, so binaries, not sources, on each new run the submodules gets downloaded again.<br>
  I know that it starts with an empty repostory because in the checkout step log I see:</p>
  
  <pre><code>git init "C:\agent\_work\3\s"
  Initialized empty Git repository in C:/agent/_work/3/s/.git/
  </code></pre>
  
  <p>I've checked here <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&amp;tabs=schema#job" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&amp;tabs=schema#job</a> and set the workspace attribute clean to <code>clean: outputs</code>.<br>
  Checked here <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&amp;tabs=schema#checkout" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&amp;tabs=schema#checkout</a> and set the checkout attribute clean to <code>clean: false</code>.<br>
  I've also controlled that the configuration of the pipeline on the website had not the clean attribute active.</p>
  
  <p>I seem to recall somewhere around 6 months ago or more (when you had <code>clean: binaries</code> instead), that this was working correctly.</p>
  
  <p>Here is a very simplified version of what the pipeline looks like:</p>
  
  <pre><code>jobs:
    - job: AJob
      displayName: "A job"
  
      pool: "Self Hosted"
  
      workspace:
        clean: outputs
  
      steps:
      - powershell: |
          git config --global core.autocrlf false
          git config --global core.symlinks true
  
      - checkout: self
        clean: false
  
      - powershell: |
          git submodule update --init &lt;path to submodule&gt;
  </code></pre>
  
  <p>EDIT:
  To add even more info, enabling the debug variable for the run I see this in the log when it initializes the Job:</p>
  
  <pre><code>##[debug]Delete existing build directory: 'C:\agent\_work\3' &lt;---- why :\
  ##[debug]Deleting build directory: 'C:\agent\_work\3'
  ##[debug]Creating build directory: 'C:\agent\_work\3'
  ##[debug]Delete existing artifacts directory: 'C:\agent\_work\3\a'
  ##[debug]Creating artifacts directory: 'C:\agent\_work\3\a'
  ##[debug]Delete existing test results directory: 'C:\agent\_work\3\TestResults'
  ##[debug]Creating test results directory: 'C:\agent\_work\3\TestResults'
  ##[debug]Creating binaries directory: 'C:\agent\_work\3\b'
  ##[debug]Creating source directory: 'C:\agent\_work\3\s'
  </code></pre>
  
  <p>Is anyone else experiencing this and knows how to resolve?</p>