TeamCity Doesn't Build Merge Requests Using Pull Requests Build Feature

Having removed "+:refs/pull/(*/merge)" from the VCS Root as specified by the text on the pull requests build feature modal box "The branch specification of your VCS Root must not contain patterns matching pull request branches."

TeamCity no longer picks up merge pull requests, it's triggering builds for feature branches only? E.g. pull/33 whereas previously it would pick up 33/merge using the branch specification in '+:refs/pull/(*/merge' in the VCS root.

How do I get around this? We currently have private and public repos for the public repos we don't want to specify +:refs/pull/(*/merge) in the VCS root because we don't want pull requests being triggered by non collaborators.

Using TeamCity Enterprise 2019.1.4 (build 66526)

2 comments
Comment actions Permalink
Official comment

Pull Requests build feature does not officially support pre-fly merge branches for pull requests (i.e. `refs/pull/<number>/merge`), only their head branches (i.e. `refs/pull/<number>/head`) in GitHub. The reason for it is that GitHub does not officially support these branches either and does not guarantee that they will always exist and their content is up-to-date. 

We are considering implementing pre-fly merging by the means of the Pull Requests plugin itself instead. That will enable such a support for all VCS hostings, not just for GitHub. This feature request (https://youtrack.jetbrains.com/issue/TW-62734) is not assigned to any particular future version of TeamCity yet. Please vote for it if you are interested.

That being said, you can of course try to enable an undocumented (an not officially supported) setting in the current Pull Requests build feature that will allow you to collect changes in the merge PR branches. To do so you will have to set TeamCity internal property `teamcity.pullRequests.buildBranchFilterEnabled` to true. Then an additional field will appear on the Pull Requests build feature dialog allowing you to select which branches you want to work with - head ones, merge ones or both. Please be aware that we can remove this undocumented setting at any point though. 

Comment actions Permalink

Thanks for the detailed explanation Anton

0

Please sign in to leave a comment.