Our development/release cycle works like this:
Accepted features are then merged into the master branch by the tester, and will therefore be released during the next release cycle (we deploy the trunk/master code weekly).
We're having frustrations with merge conflicts, because by the time the tester has UAT'ed the feature and discovered that it won't merge cleanly, the developer who worked in it has normally moved on to something else.
We're considering a solution whereby every feature branch is automatically merged, by TeamCity, against the current master branch, and any build resulting in a merge conflict is considered a failed build - this will give us early visibility on problematic merges so we can fix them sooner.
TeamCity doesn't appear to have built-in support for this workflow (i.e. when a push happens to branch X, checkout master, merge branch X onto it, build, unit-test, create package). Has anyone created a similar workflow using TeamCity and Github - using custom msbuild targets, perhaps?
EDIT: I should clarify that we're using Github but we're not currently using pull requests - sounds like this is something I should investigate. :)
Enable automatic branch merging for a single repository Go to Repository settings > Branches. Under Automatic merging, select the On status and then select Save.
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch. So we need to be on the branch that we are merging into.
Merge branches Select the branch that you want to merge into the current branch, click Modify options and choose from the following: --no-ff : a merge commit will be created in all cases, even if the merge could be resolved as a fast-forward.
If you're using Github and Pull Requests then check out Hadi Hariri's blog post about how to get the pull request after it has been merged with master:
http://hadihariri.com/2013/02/06/automatically-building-pull-requests-from-github-with-teamcity/
Github does an automatic merge for every pull request and the resulting merge is available (though pretty much undocumented) as
git fetch origin +refs/pull/298/merge
where pull request id is 298. And so all merged pull requests can be fetched with a wildcard in place of the id in Teamcity and be built automatically. The branch specification would look like this:
+refs/pull/*/merge
EDIT: You say you're not using pull requests so I guess you could do this with some git commands. I haven't tried this out myself so these are only a few tips to get you started.
To check for merge conflicts, one of these strategies should work.
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