Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automerging from release build back to trunk

Chris Wundram November 18, 2013

I am looking for a good way to automatically merge on push from a release build like release/3.0 back to my main/default branch (in this case it is called dev). The thinking is that I want any change made in a release branch to also be in the dev branch. I looked at the auto merge function from Stash. That appears to only merge downstream to later release branches, but not upstream to the dev branch.

My next thought was to use the auto merge feature in bamboo, as I am already doing a build on each push. The problem there is that I don't want to build the merge, I want to run the build on release/3.0, and if successful, then merge release/3.0 into dev, and push to dev, but the build results are just from release/3.0.

The only way I can think to do this is to use a post receive hook to automatically merge any push to release/* to dev. https://blogs.atlassian.com/2013/05/git-automatic-merges-with-server-side-hooks-for-the-win/ explains how to do this. What isn't clear is what happens when the merge has conflicts? Also, if I merge to release/3.0 via a pull request, I'm not sure this would even trigger the post receive hook.

Any ideas?

2 answers

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2013

Hi Chris,

This sounds exactly like the automerge feature you mentioned. If 'dev' is set as the 'default' branch in the repository it should work. Although currently it only kicks off when a pull request is merged, not when you push to the release branch.

Regarding your question about conflicts - our automerge plugin will raise a pull request and email the original 'author' when that happens. When those conflicts are resolved the merge will continue to be automerged up the release chain until it hits the default branch.

(Doing a merge via a Pull Request does fire a Stash-level AsyncPostReceiveHook, but not an _actual_ Git hook as it wasn't done via a push)

We use automerge in Stash heavily and I couldn't imagine going back to doing it any other way. :)

Cheers,

Charles

0 votes
Chris Wundram November 24, 2013

I solved this issue by creating a second build plan on bamboo just for doing the merges. It doesn't produce any artifacts, just tests the merge down to dev to see that it merges and builds.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events