Auto-created Git branches always building in Bamboo

Paul Smith March 4, 2013

We've recently updated to Bamboo 4.4.3 and we're trying to use the automatic branch creation for Git. What we'd like ideally is for all pushes to the "master" branch to build automatically, but pushes to developer branches (for our purposes it's enough to say "not master") to only build when requested manually.

That was not an option, and by setting the trigger on the parent plan to build on each commit, which is what we used to do, all the branch plans also did this.

So, we changed the parent plan to use "Repository triggers the build", and added a trigger to our Git repository, that only requested a new build if the change went to the master branch. This is successful at having the master branch build on commit, so we know the trigger etc. is hooked up properly.

However, we're STILL seeing a build start every time a new branch is detected. Our builds take a long time, and it's not useful to run a build merely for starting a new branch in the Git repository: we tend to make a lot of small branches and this is causing our build servers to be constantly loaded with useless builds.

Is this a known problem? Is there a workaround? Or do we seem to be doing something wrong?

Cheers!

2 answers

1 accepted

0 votes
Answer accepted
Paul Smith March 10, 2013

I filed the bug above. In the meantime what I've done is create a clone of the "main" plan, enable Git branches on the clone, and remove all triggers from the clone so that it will only run by manual request. Then I removed the branch auto-create capability from the original plan so it's still triggered by repo request but doesn't get new branches created.

This is kind of a drag, to have to maintain two different plans where I want identical behavior (if I make changes to one I'll have to remember to make those changes to the other as well) but the behavior is much more predictable. When the bug is fixed in Bamboo I'll revisit.

Cheers!

0 votes
PiotrA
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.
March 5, 2013

Hi Paul,

AFAIK this is a known limitation of Bamboo - and I think you will be interested in the https://jira.atlassian.com/browse/BAM-12451 - this issue seems to be exactly what you would request Bamboo to have. So it might be a good idea if you place your vote on that issue (and add yourself as a watcher).

What would you say?

cheers!

Paul Smith March 5, 2013

Thanks for the note. I think that bug is similar to what I'm looking for, but that seems like an enhancement request, although a useful one. I think the behavior I'm observing is actually a bug. I'm happy enough with the supported method of only triggering a build when requested by the repository. That works well.

My problem is that it seems that builds are ALSO being kicked off automatically by Bamboo whenever a new branch is added to the plan. I don't want that, and it doesn't seem useful to me. If I set the trigger to "Repository triggers the build", then I don't expect Bamboo to ever trigger builds on its own. But it does.

PiotrA
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.
March 5, 2013

Ah, so you would like to have the plan branches detected&created, but without the initial build (#1) to be triggered by Bamboo (the one that has the "initial build" visible as a trigger reason, instead of "manual build" or "scheduled" or whatever trigger reason) ?

From what I see in Bamboo code it seems to me that this initial build is always triggered when a newly plan (or a branch!) created has at least one Trigger defined (so only "manually" triggered plans will have no initial builds for branches). I'm not sure if that's a bug or feature.

Anyway, I think it would be good idea if you would raise a bug issue on https://jira.atlassian.com for Bamboo project - it seems quite legit to be able configuring Bamboo whether it should or should not spin up the initial build for the auto-detected branches, especially if the main plan Trigger is something different than "Poll repository for changes".

Does this sound OK to you?

Paul Smith March 5, 2013

Oh I see you wanted a Jira ticket not a support ticket. Oops. Should I refile? Or can you move it?

Paul Smith March 5, 2013

OK I created https://support.atlassian.com/browse/BSP-9451

Thanks.

I have a new issue. As a test last night I created a new branch and the build was started, as we've discussed above. Then I pushed a commit to that branch and the build was not started, which was correct and expected since my trigger didn't fire on a private branch. I thought I understood what was going on and went to bed :-).

But then this morning (7 hours later), seemingly out of the blue, a build was started on my new branch! I have no idea why (I was not even in the office when it started). The build type shows "Changes by <me>". I did make changes, but it was 7 hours before AND the build type was set to "Repository triggers the build".

This is very curious. Should I file a separate bug about this? Are there logs somewhere on the Bamboo server, or something, that might give more details as to why it decided to start a build at that time?

PiotrA
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.
March 5, 2013

BSP-9451 has been copied to BAM-12944

PiotrA
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.
March 5, 2013

As for the second issue - you should have somewhere atlassian-bamboo.log file(s) on the Bamboo Server (where exactly? - you can check that via Bamboo->Admin->System Information page). They could contain information about code change detections/triggers. But I'm not 100% sure we're logging each occurence. Worth a try anyway.

Paul Smith March 5, 2013

Thanks for the pointer. You were right, there's nothing in the log about why the build was started. Should I file a case about this as well?

PiotrA
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.
March 6, 2013

Yup, that might be a good idea.

Paul Smith March 18, 2013

Stefan, I can no longer seem to find BAM-12944 although I was pretty sure it was there when you first filed it. Maybe it got relinked to a different user account and I can't see it anymore? Or it got deleted? But I didn't get any email.

PiotrA
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.
March 18, 2013

No idea. I've just checked and from my side it is still visible under the https://jira.atlassian.com/browse/BAM-12944 url. I don't see any permission restrictions set up... so... perhaps it's yet another mysterious case for Sherlock Holmes?

edit: maybe it was intermittent? Can't you still access that issue?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events