Auto-created Git branches always building in Bamboo

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

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!

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!

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.

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?

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

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?

BSP-9451 has been copied to BAM-12944

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.

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?

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.

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 Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,067 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot