We're using TeamCity Professional 9.1.1 with Git/Stash for version control and I'm trying to get automatic branch merging working.
Our scenario is that the devs create feature branches from master named feature/name-of-feature. Once the feature is ready for testing they merge the branch into an integration branch. We'd like to automate this in teamcity.
I've managed to get feature and bugfix branches building automatically by adding this to our Branch specification: in the VCS root for the master branch
+:refs/heads/feature/*
+:refs/heads/bugfix/*
But I'm struggling to get the feature branches to merge automatically into the integration branch. I've added an automatic merge build feature and I've tried various combinations of 'Watch builds in branches' and 'Merge into branch:' For 'Watch builds in branches' I currently have
+:feature*
+:bugfix*
and for 'Merge into branch:'
integration
and I've also tried
+:feature/*
+:bugfix/*
and
+:refs/heads/feature/*
+:refs/heads/bugfix/*
The builds are successful but the branch doesn't get merged into integration and there are no messages in the log.
Any ideas what I'm doing wrong?
I know this is an old post but I just ran into the same scenario where the automatic merge was not being triggered (I'm using TC 2017). Note that because I don't know much about the OP repo I might be a bit off to solve this particular question, but perhaps I could help future visitors. In general, there are three things to be configured, the VCS, the automatic merge itself and the build triggers.
The Automatic Merge build feature tracks builds in branches matched by the configured filter and merges them into a specified destination branch if the build satisfies the condition configured (e.g. the build is successful). The merge occurs after the build finishes.
What's not immediately clear is that The merge occurs after the build on the source branch finishes. So, in short my issue was that my triggers were configured to only build the default branch, so the feature branches never build and thus never merged.
P.S. If you asked me I'd change the behavior so that merges happen regardless of the branch that triggered it, but I understand it would be hard to control scenarios where the feature branches have bugs and don't compile, TC could maybe run a build before the merge and another after, but this could have a big performance impact on the runners.
P.S.S. Another option is to configure it the way around (which is what I intend to do further down the line). Because I have separate builds for the feature branches, I will configure the automatic merge there, to push the changes that just built into the main branch. This should automatically also trigger a build on the main branch, completing the cycle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With