This is the Jetbrains TeamCity plugin what our company uses as a workaround for TW-23879. Unfortunately in TeamCity 7.x Scheduler Build Trigger is not aware about Git branches and always uses default branch to trigger a build. This plugin helps me to escape lack of integration tests run while we are waiting for TeamCity 8.x. This plugin works the same way as original Scheduler Build Trigger, but add branches awareness.
Clone project repository or just download plugin zip.
Put plugin zip into your TeamCity plugins folder. Usually it's here: ~/.BuildServer/plugins.
Restart TeamCity instance.
Open desired build configuration and create new Git Scheduling Trigger.
Except of original properties you can set up two new:
Build default branch or not. By default - yes. Uncheck if you don't want to build default, only other branches. Default branch is branch was chosen as default in VCS root. If you are thinking why I did it, read tricks section below.
List of additional branches, separated by comma. Use original names like release 1.1.x for example. Do not use refs or origin prefix here. In my case VCS root have master as default branch. So if I want to run build for master and two additional branches, I have the next:
Save and that's it.
Disclaimer, license, compatibility and so on.
I do not guarantee it'll work on your instance and of course have no responsibility for potential damage :) I checked plugin on 7.1.3 instance (plugin development), and 7.1.1 (company-wide CI) TeamCity. It works for us. Feel free to leave other compatibility feedback. Any case, it's just while we are waiting JetBrains will develop it by themselves. Also I checked clean checkout, run on all agents and only pending changes function, it works for every desired branch. We use only daily schedule, so I didn't check weekly and cron schedule. Any feedback - welcome. Also I didn't check multi VCS roots case, may be it'll not work :(
TeamCity code has specific branches model. So didn't find a way to get a real name of default branch. If you make VCS root with master as default, I couldn't in runtime understand it. Only information I have that this one branch object is default one. So I made that tricky checkbox I want you to tell me build default one or not. So if master is default - do not write it master in list of branches. It available branches objects list it have name :). But if default branch is not master, you can write master in list of branches :)
Additional branches name
And one more trick. Available in runtime branches list have no full branch specification. Only names. And in case if you use brackets to short branches name, available names also will be shorten. For example desired branches list: product-1.9.x, product-1.10.x
And we have next branches in VCS root:
Available branch names would be default, 1.9.x, 1.10.x. But if we do not use brackets, available branch names would be default, refs/heads/product-(1.10.x), refs/heads/product-(1.9.x) To match what branches need to be run, I crop refs/heads/ prefix and check is desired branch name contains available branch name. So in first case I check that product-1.10.x contains 1.10.x. In second case that product-1.10.x contains product-1.10.x. Huh. So be careful because contains can be a cause of wrong behavior.
Not sure you want to contribute 2 files project, but if you are:
It's not Maven project, it's difficult to maintain TeamCity instance libraries through Maven.
It's IntelliJ Idea project, so repository includes .idea files. It's necessary to make right final artifact. Sorry, I had no time to make Ant build. May be you have.