Why does branch merging not work in Bamboo OnDemand?

Alexander Aickin July 19, 2012

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

0 votes
Alexander Aickin July 19, 2012

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 .

Alexander Aickin July 20, 2012

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!).

0 votes
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 19, 2012

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events