Why does branch merging not work in Bamboo OnDemand?

I've been trying out Bamboo OnDemand to get a sense for how automatic branch merging works, but I haven't been able to get it to ever work correctly. I made a simple repo on Bitbucket, put a simple maven prototype project into it and got it built. Then, I checked a simple failing test in called testBreaksInFeature into a branch called feature. I checked in an extra comment to master. The feature branch's build started failing in Bamboo, as expected, and the master branch did not. All good so far.

Next, I turned on branch merging, using Gatekeeper, and ran the build again. This time, to my surprise the build worked: no failing test. I logged into the elastic instance, sudo'ed up, and found the working directory for the job. Weirdly, git status revealed that the current branch was feature, and the staged changes in the directory were a deletion of the new test in the feature branch plus the addition of the comment from master. In other words, rather than being a merge from feature to master, it was a changeset that just turned feature into what master already had.

I was trying to figure out what was going on, so I replaced /usr/bin/git with a script that would log every call to git and then pass through to the real git. I found that Bamboo was calling the following sequence of commands:

I ran this sequence of commands in the working directory on the elastic instance, and then ran git status. That showed that I was still on master, and the staged changes were a clean merge from feature, failing test and all. But when I run the build with Gatekeeper, the working directory instead ends up on feature branch with bad changes staged that get rid of all feature changes.
What could be going on here? I set the elastic instance to have a git capability of /usr/bin/git, which I presume is right. I've logged all calls to that version of git, but the build's sequence of calls to /usr/bin/git works just fine when you run it manually.
Is Bamboo somehow using a combination of command line git and JGit in a way that's screwing up? How is my repo getting in this state before the build?

2 answers

This widget could not be displayed.

I set the elastic instance to have a git capability of /usr/bin/git

That's correct. Update on Monday will add that capabilty be default.

Is Bamboo somehow using a combination of command line git and JGit in a way that's screwing up?

Possibly. I think it's best if you contacted support, we will be able to figure out what's happening there.

This widget could not be displayed.

Thanks!

Glad to hear that the Git capability will be default; it was really, really confusing to figure out what was wrong with branch merging at first (with Github the error message was something like "Error merging branch: null", while with Bitbucket there was at least a stack trace, although it was not super helpful).

I opened a support ticket for the issue as you suggested: JST-42618 .

Worth noting that this feature works better, but not perfectly with Mercurial. Gatekeeper seems to work correctly with branch merging (hooray!), but for some reason, merging back to master on a clean feature branch build gives "Failure Reason Exception during push: null" (boo!).

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 10 hours ago in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

39 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you