Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tfs build retention on pull request

I am running tfs 2015 and have it build when a pull request is create to a certain branch.

It appears that the retention policies are not working on it as they should be only lasting 1 day and they are there for months at a time.

I think the problem is the source branch. on the pull requests builds it has it as the refs/pull/688/merge. The retention policies look for refs/heads/*.

Is this why they are not getting deleted and if so how can I add the pull request builds to get them deleted?

I have tried typing refs/pull/* in the retention but it comes back as refs/head/refs/pull/*

like image 963
user833831 Avatar asked Oct 31 '22 01:10

user833831


2 Answers

This is due to the refs/pull/688/merge branch was created and only for the build of pull request. However, the normal branch is refer/heads/(master/feature/...). It's not in the branch filters of normal branch. So the build retention has no effect on the pull request build.

For now, you may have to delete the pull request builds manually. You can also add a user voice in this site for this feature request. PM will kindly review it.

like image 94
PatrickLu-MSFT Avatar answered Nov 15 '22 19:11

PatrickLu-MSFT


It's explained in Microsoft's documentation here. Your Minimum to keep is not zero, so there will always be something kept for the pull requests "branches".

In your case you want to add a new retention policy with 1 for Days to keep 0 for Minimum to keep and refs/pull/* for Branch specification / Branch filters

In 2017 (local, not VSTS) typing /ref/pull/* doesn't work, you end up with +refs/heads//ref/pull/* - the + being the include. Typing refs/pull/* works fine and you get +refs/pull/*

like image 41
Sacha K Avatar answered Nov 15 '22 21:11

Sacha K