Using repository-driven build triggers
When you're running thousands of builds with several plan branches each, the savings add up fast.
One thing nearly all companies who use Git have in common is that they tend to have a lot of repositories. And each of those repos has to be hooked up to the continuous delivery pipeline in order to be built, tested, and deployed as part of an application.
One of our tips for CI-friendly Git repositories is to have your repo call out to your CI server when changes come in (instead of having the CI server spend cycles polling the repo). Here's a deeper dive into the repository-driven build triggers you can use when you connect Bitbucket and Bamboo.
Linking to protected repositories
Every time a new repo is created in Bitbucket, Bamboo discovers it and pulls in all the information needed to build from it, even if the repo has tight controls around who can write to it. At that point, you can use it as a linked repository in Bamboo, without having to know the repo's authentication credentials.This not only simplifies a set-up task, it also means that teams who don’t control the repository (or have access to the source code through any human-readable medium) can still pull it into their builds – once a linked repository is set up, it can be used globally throughout your Bamboo instance.
Let’s say my team works on a shopping app that depends on a core billing service, whose code is highly protected because so many other teams rely on it. I can do a fresh build of the billing service with each CI run so changes to my app are always tested against the latest changes to the billing service – without having to request special permissions from IT or asking someone from the billing team to set up that part of my build for me.
Triggering builds from Bitbucket
Just as configuring repositories for each build plan would waste a lot of your time, having lots of builds polling lots of repos looking for changes amounts to a lot of wasted CPU cycles for the CI server. To solve this, Bitbucket repos can call out to Bamboo and pro-actively trigger the appropriate builds when new changes come in. Of course this can be done with any version control system and any CI server. But with Bamboo and Bitbucket there are no special configurations, scripts, or web hooks required.
To see all trigger options, go to the configuration space of your plan, click on the triggers tab, then add trigger, and select the trigger type that works best for you.
Though this is very easy to set up, we didn't want to leave your existing build plans in the lurch when we introduced this feature. So we made a companion feature: a bulk update option for triggers, which means you can scale up Git without scaling server load or scaling your build engineers’ overtime hours. Navigate to your Bamboo's overview screen and select Bulk action from the left panel. You can then choose replace triggers and update plans with new triggers in bulk!
Repository-driven triggers are a powerful way to conserve CPU cycles on your Bamboo server, and shave a few minutes off the time it takes to get feedback on your changes. Be sure to check out our next article, about the quiet period, to learn how you can multiple commits that come in rapid succession into a single build.
on a related note...
Monorepos in Git
When issues arise when dealing with monorepos using Git, we've got tips to mitigate them. Read on.
Put it into practice
Continuous delivery from code to customer
Bamboo is a continuous delivery tool that ties automated builds, tests and releases together in a single workflow. Take the tour to learn more.