title: Azure DevOps Server 2019 Retention Policy no longer working
body: <p>Last week we have migrated from TFVC to Git on our ADS 2019.1 server.</p>
  
  <p>On our validation pipeline we have an aggressive retention policy.
  It is set to Keep for 2 days, 10 good builds with the branch filter * and all checkboxes cleared
  ADS writes it as: +refs/heads/*</p>
  
  <p>What we see is that since we migrated, none of the Git builds have been deleted. From the last 8 days we now have hundreds of builds with their multi-GB drop. </p>
  
  <p>Is * the right branch filter to use ? This was the default setting entered by ADS, we do indeed want all builds for all branches to be deleted by this policy.</p>
  
  <p>I also tried **, but that made no change, in the build results page i see all build are build off a temporary branch with a 4 digit number, which is probably the pull request number.</p>
  
  <p>How can we ensure the builds are cleaned up as per the retention policies ?</p>
  
  <p>The Build definition is not linked to a Release pipeline. The builds are triggered from the Pull Requests created by developers. The Pull requests are marked as Completed.</p>
  
  <p>Another build definition, one with a CI trigger that runs after every commit, does still seem to delete builds based on the retention policy defined.</p>
  
  <p>Picture of our TFS Retention policy settings. Master builds are cleaned up, pull request builds are not
  <a href="https://i.stack.imgur.com/KeAGS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KeAGS.png" alt="Retention policy settings Pull request build"></a></p>
  
  <p>List of the oldest builds in TFS after manual cleanup last week, these builds are now 4-5 days old, over the 2 day limit of the retention policy.
  Also you can see there is no retain lock behind them.
  <a href="https://i.stack.imgur.com/18ceV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/18ceV.png" alt="Oldest builds under build history"></a></p>
  
  <p>Overview of the deleted builds. You can see 'master' builds in there that have been deleted by the retention policy.
  <a href="https://i.stack.imgur.com/XlbTD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XlbTD.png" alt="Latest deleted builds"></a></p>
  
  <p>Shows the master builds are deleted after the 2 day retention policy setting
  <a href="https://i.stack.imgur.com/aI28f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aI28f.png" alt="Deleted build by retention"></a></p>