Way to pin last successful build of each branch?

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?


1 comment
Comment actions Permalink

Hello Marc,

Currently it is not possible to clean up all builds except for the last success one. Please vote for the related request: https://youtrack.jetbrains.com/issue/TW-8717.
You can configure clean-up rules not to delete builds older than one (x) successful build. Clean-up rules are applied independently to each active branch. You can use parameter teamcity.activeBuildBranch.age.hours to define the period when the branch is active.
It is not possible to automatically pin builds. You can pin builds using REST API.


Please sign in to leave a comment.