By Thomas Behlau
The auto-merge configuration in Bamboo is part of the "Branches" settings page. After checking the "Branch merging enabled" options, two options will appear for choosing the desired merge functionality.
Options one is the "Branch Updater" option. If this option is chosen, each build of the "base plan" will trigger the updater, after which the code for each branch plan will be checked out, changes from the base plan will be merged into each branch plan and the build for the branch plans will be executed. After a successful build, the code merge can be pushed back to the repository.
The following image illustrates that behavior:
The configuration of the branch updates itself is very easy. The only options you have to specify are the "base plan" (or "Merge From" in the UI) and whether or not you want commit the changes back to the repository.
If the Gatekeeper option is chosen for auto-merging, then the behavior is the opposite of the branch updater. In the case of the gatekeeper, each feature branch is checked out. After a successful build of the feature branch, the code of the base plan is checked out and the code change from the feature branch is merged into the base plan. The build of the base plan is executed and the merged code is optionally pushed back to the repository.
The configuration of the Gatekeeper is straightforward. In the options panel you can configure the base plan and whether or not the merged code should be pushed back to the repository.
Build And Merge Failures
The big question when using automated features is always: "What happens if something does not work?" First let's look at build failures. If any of the builds fails in either one of the configurations, the build will be marked as failed, no merge will be executed and obviously no code merges will be pushed back to the repository. In the case of a merge failure, Bamboo will create a pull request for the failed merge. This allows a team member to take care of the issue.
Using the automated merging tools in Stash and Bamboo can show a huge benefit in your development process. No longer do you have to designate a team member to merge changes between branches to keep up with the development of other teams. You also do not have to worry about keeping up with all the releases you are maintaining. In most cases the Atlassian tools will take care of it. In the case that something does go wrong, Bamboo and Stash will create pull requests that help to diagnose and solve any problems.