Keeping Bamboo happy during Stash downtime

We have Stash 2.10.0 linked with Bamboo 5.3 for builds, both running as Windows services.

Build Plans in Bamboo are set to poll Stash every 5 minutes for changes, and build when necessary. This works great most of the time, except when Stash is down for backup (which I do by stopping the service and tar'ing up Stash home before restarting).

During the Stash downtime, Bamboo reports "Unable to detect changes" errors for each plan - not surprising since Stash is not responding.

So in an attempt to avoid these, I tried shutting the Bamboo server service down for the duration of the Stash backup, but I've found that this then causes the remote Build Agents to go offline and I have to manually restart them.

The only solution I've come up with to avoid error conditions is to switch the repository polling from "Every 5 minutes" to cron based , excluding the the backup period, such as "0 0/5 06-22 * * ?" (ok the backup doesn't take 8 hours!). But this will mean every plan firing off at the same second every 5 minutes unless I choose different second/minute combination for each plan, which is a pain as I'm trying to standardise as much configuration as possible between plans.

Is there any other solution that you can suggest which avoids explicit scheduling? Getting the remote agents to cope with server downtime would be preferable I think.

3 answers

1 accepted

Hi John,

You could also just trigger your builds using a post-receive hook in Stash.

https://marketplace.atlassian.com/plugins/com.atlassian.stash.plugin.stash-web-post-receive-hooks-plugin

using the following url to your build plan :

http://<bamboo-server>/api/rest/updateAndBuild.action?buildKey=<projectkey>-<plankey>

You'll need to add a remote trigger to your Bamboo build plan so it can be triggered by this call.

If you do this then your problems are nonexistent :)

Best regards,

Peter

Thanks, Peter, I was vaguely aware of this possibility but hadn't investigated it yet. I'll give it a try, although from what I've read in other posts I think I have to explicitly install the hook in every new repo when a build plan is set up for it.

BTW I've since realised that I could use a cron expression to schedule the polling as well, but I'd still have the "everything polls together" problem.

Hi John,

I just made a quick blogpost about it : http://www.petervandevoorde.com/2014/01/21/triggering-a-build-in-bamboo-from-stash/

It gives step by step instructions.

You will indeed need to do this for each repo and new build plan.

Best regards,

Peter

Sounds painful! It would definitely be much easier to be able to define a global view in Bamboo as to when Stash is going to be offline for a backup.

Ah well, I should have fully checked before submitting this question. Cron-based scheduling runs the plan every 5 minutes irrespective of whether any changes were committed. So that's no good either :-(

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
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,319 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