One of the things we have in our CI setup is we have a coverage diff build config for pull requests. For a pull request, we analyze the coverage and then we download the coverage and source code tarball from the last successful build of the target branch and then we run a program called pycobertura that is able to diff the two sets of coverage data and figure out if the pull request has added lines of code that aren't tested.
The issue that we run into fairly often is that this build config fails because it gets a 404 error when attempting to download the source code tarball of the last successful build for the target branch.
I think what is happening is that if the target branch hasn't been built in a few days, TeamCity might sometimes clean up that build so it no longer exists.
I've looked at the cleanup settings and I can't find a setting that would make sure this doesn't happen.
I was hoping to maybe be able to specify that TeamCity always keep the last successful build of each branch but feel free to delete any builds that are not the latest for their branch.
Is there some way of doing that?
Or another suggestion for avoiding the issue I mentioned?