Hi there,
Is it possible with BitBucket to trigger different Bamboo build plans based on which branch was updated?
Cheers
Hi Matin-
Bamboo does actually support setting triggers for branch builds that are different from master's triggers.
First, make sure you have plan branches enabled. Go to ${PLAN} > Configure Plan > Branches and check the box marked "Automatically manage branches". Bamboo will search through your Bitbucket repo and clone your CI scheme for each of the branches it finds.
With that in place, you can adjust the trigger for your branch if you want to. Polling the branch for changes every 30 seconds is a pretty common option. Go to ${PLAN} > ${BRANCH} > Configure Branch. There's an option to change the trigger type for your branch. You can also fine-tune the notifications and variables for each branch while you're there.
If I have 'automatically manage branches' set I would not want to manually manage each branch by configuring it to have a different trigger. In a scenario where I want my 'feature' branch plans to have different stages to the 'develop' branch they come off of, I will use separate plans due to not wanting some stages to only be available from certain branches. This is following a video posted on an atlassian blog for the gitflow scenario. (https://groups.google.com/forum/#!topic/maven-jgitflow-users/qqlemk-8tKY)
In this video, the trigger behaviour was highlighted as a bug, and then a ""feature"". I have no desire to repeat develop branch builds 3 times, and see it as a bug. Why can't I have the main plan not trigger automatically but the branch plans trigger automatically, without having to manually update every automatically created branch plan (defeating the purpose). The only workaround I can think of is to have the main trigger track a dummy branch that never changes and poll this, such that branch plans tracking feature branches will poll and find changes. It is not an appealing workaround - am I missing something?
Any help appreciated. At the moment, it doesn't seem like plans that automatically manage branches are meant to handle branches any differently from the mainline repository branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've got the exact same problem. A change to a branch triggers the build on master and not on the branch...
That's weird that these two tools are not able to communicate correctly.
I would appreciate if someone find a solution. It's sad that we have to use polling. The process is less reactive with that...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I un-marked this as an answer. Unfortunately this approach does not work if you have automatic branch management.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can implement extremely flexible (conditional, branch-dependent, etc.) Bamboo builds with the Better DevOps Automation app by creating a new automation rule:
This approach is highly customizable. Here is an advanced example where the build can be selected from the commit message (it's different from your use case, but demonstrates the flexibility very well):
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We had trouble getting our branch-specific Bamboo builds triggered by Bitbucket Cloud for our Solinor's Payment Highway, but managed to fix this using the following solution:
You should still configure rather low, e.g. 60 seconds Branch detection interval (System -> General configuration) as unlike in Stash, new branches are not pushed, but rather pulled. However after pulled once, the new pushes will trigger builds via the remote trigger.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Martin,
There are no separate triggeres for branch plans; there is only the default trigger, and we track this issue. You can run this command and trigger a branch plan:
curl -X POST --user admin:admin "http://localhost:8085/rest/api/latest/queue/PROJ1-PLAN10?executeAllStages=true"
where 'admin:admin' is the username:password of your Bamboo user, and 'PROJ1-PLAN10' is the plan branch key. I hope this answers your question.
Armen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sarah - thanks for your notes on this. So I followed your steps, enabbled "Automatically manage branches" and under branches I see the branch that I want Bamboo to run trigger the shell command scripts. But these shell scripts are associated to "Default Job" under "Default Stage" and Bamboo still triggers the plan even though I commited and pushed changes to a different branch than the one I m interest in. I mean I don't see plan specific tasks, so the master triggers are the ones that get executed. What am I missing?
P.S. Bamboo 5.3 build 4101
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there Matin,
Bitbucket simply triggers when any code is pushed to Bitbucket. You can configure what you are looking for in Bamboo. Check out the documentation on plan branching.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that Marcus.
I guess the issue im having is that a commit to a non-master branch only seems to trigger in Bamboo the main build plan, rather than the associated plan branch.
i.e. if i push to a "test" branch in BitBucket, the main build plan configured in the Services option is run, and not the branch plan created specifically for the "test" branch.
Any advice you may have would be appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.