Howto only build branches that exist in both VCS repositories


We have two repositories where one is the main project and the other is a shared library. We want to trigger a build on a commit in branch X of both repositories but we DO NOT want teamcity to fallback to the default branch if the same branch does not exist in the other repository.

Example from documentation:

Multiple VCS roots

If your build configuration uses more than one VCS root and in both VCS roots you have specified branches to monitor, the way how builds are triggered is more complicated.
VCS Trigger groups branches from several VCS roots by the part matched by star. When some root doesn't have branch from the other root, its default branch is used. For example you have 2 VCS roots, both have default branchrefs/heads/master, first root has branch specification refs/heads/7.1/* and changes in branches refs/heads/7.1/feature1 and refs/heads/7.1/feature2, second root has specification refs/heads/devel/* and changes in branch refs/heads/devel/feature1. In this case VCS trigger runs 3 builds with revisions from following branches combinations:

root1 root2
refs/heads/master refs/heads/master
refs/heads/7.1/feature1 refs/heads/devel/feature1
refs/heads/7.1/feature2 refs/heads/master

We don't want the third case to happen, instead the build should not run at all.

Is this possible?

1 comment
Comment actions Permalink

Hi Henrik,

Thank you for the detailed descriptio of the case.

Unfortunately, this is not possible at the moment. The closes you can have is to establish an external process which will figure out the branches and will update the branch specs of the participating build configurations to the list.
The process can be run within a dedicate maintenance build in TeamCity and you can update wither VCS roots directly, or a parameter used in the VCS roots via REST API.

Seems that your case is related to the feature request.


Please sign in to leave a comment.