TeamCity starts two builds for a commit that is part of multiple Pull-Requests
I have a TeamCity build configuration that is meant to start builds only for Pull-Requests that are created or have commits added to them. So builds are not supposed to start when a single commit is pushed to a repository on its own. This works perfectly.
The configuration can be seen below:

The only issue I have is that if the same commit is part of two Pull-Requests, two builds will be started. This is normal, given the configuration of TeamCity. I have however wondered if it is possible to limit build triggers in such a way that build is triggered only for one of the Pull-Requests. Is there any way to do this with TeamCity?
Please sign in to leave a comment.
Hi Gudmundur,
TeamCity has a parameter to configure this behavior, namely
teamcity.vcsTrigger.runBuildOnSameRevisionInEveryBranch, which can be set to false. That should do the trick, could you try it?Hi Denis,
Thanks for the suggestion.
I did try setting this parameter, but it did not work:
I added the parameter twice in different formats, because the TeamCity instructions are not very clear on how to do this.
Is it possible that TeamCity does not support this parameter anymore?
Hi, and sorry for the delay, holiday season made it hard to answer.
The parameter still works, but unfortunately it only covers partially this scenario. When the same commit is going to be built in multiple different branches, it will indeed prevent it from building in them, but only if a build on that revision existed already previously, not if this is the first time that commit is ever being built and multiple branches are triggered at the same time.
I am not aware currently of the possibility of limiting triggering this, but if you could explain your scenario as to why (and how) multiple pull requests hold the same commit it might be possible for us to work on covering it as a feature.
As a follow up and side note, we have an issue in our tracker about this parameter not helping under some scenarios, such as fast forward merges: https://youtrack.jetbrains.com/issue/TW-58558