Bamboo Build Plan Triggers
Asked by Himanshu Rawat:

Hi,

I am trying to use Bamboo Build Plan Triggers functionality for multiple repositories.

Below is the setup I have.

1. Build Plan --\> Plan Configuration --\> Repositories ( Added three repositories ). All three are **NOT** converted to linked repository.
2. Build Plan --\> Plan Configuration --\> Triggers.
   1. Added Trigger (Bitbucket Server repository triggered)
   2. Trigger configuration, checked all three repositories.
3. Build Plan --\> Plan Configuration --\> Branches
   1. Create Plan Branch --\> When new branch in repository is created

Below bitbucket activity is done on the 3rd repository which is configured as above

1. Created a branch
2. Committed and Pushed changes to that branch.

I expected as per above setup, a plan branch build should trigger but it isn't happening.

What's happening is any activity defined above, done on 1st repository works.

So the 'trigger' functionality only works for first repository.

**My Goal:**

To add multiple repositories (which is done) and configure triggers on all repositories to trigger the same build plan when some activity (such as commit on a branch) is done on the repositories..

Please assist
> Atlassian Bamboo version 6.6.3 build 60607 - 25 Sep 18
>
> Atlassian Bitbucket v5.7.0

Thanks,

Himanshu


Answers:
author: Daniel Santos
body: Hi [@Himanshu Rawat](/t5/user/viewprofilepage/user-id/3526395)

Bamboo plans will only create plan branches for the main repository. This is expected.  
It is indeed a complex subject. If Bamboo created the branch as you expect, what would be the branch of other repositories in this build? Difficult to decide...

The current Bamboo design only has plan branches for the first repository and all other repositories will be set to use their default branch for builds. The branches can be manually adjusted for each plan branch.

There is a feature request to help to adjust this automatically:

* [\[BAM-19898\] Plans braches using multiple repositories could automatically checkout them using the same source branch name.](https://jira.atlassian.com/browse/BAM-19898)

The triggers should work for all of them, but from your description, I assume that you have plan branches defined like:

```
| Repository  | Plan branch | Repository Branch |
| Main Repo? ?| "Default"   | master            |
| Repo 2      |             | master            |
| Repo 3      |             | master            |
```

```
| Repository  | Plan branch | Repository Branch |
| Main Repo? ?| "Develop"   | develop           |
| Repo 2      |             | master            |
| Repo 3      |             | master            |
```

This is to say that if you commit in Repo 2 or 3, it will only trigger a build if the commit is happening in master (or whatever repository branch configured in the plan branches available).  

Does that make any sense?  
I'll wait for your comments.

comments: author: Himanshu Rawat
body: Hi [@Daniel Santos](/t5/user/viewprofilepage/user-id/502125) ,

Thank you for the response and also sharing the feature request ticket.
> The branches can be manually adjusted for each plan branch.

It will be tedious work instead I would create individual bamboo builds for respective repositories. Manual doesn't fit in the equation of automatic builds ;)

But like you said and explicated in the mentioned JIRA ticket, trigger behavior is only limited to Plan's main repository
> This is to say that if you commit in Repo 2 or 3, it will only trigger a build if the commit is happening in master (or whatever repository branch configured in the plan branches available).

We don't commit on master branches so below will be our final configuration

```
Plan --> Branches --> Create plan branch --> When pull request is created
```

But I understood your point and hope to see this functionality implemented.

I am still confused on the trigger configuration? There are 4 different repositories and it only works for 1st repository in the list.

Then is there a reason show other repositories and allowing them to check it?

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64142iF71A780BD471E698/image-size/large?v=v2&px=999 "Capture.PNG")


author: Daniel Santos
body: Hi [@Himanshu Rawat](/t5/user/viewprofilepage/user-id/3526395)

The build should be triggered by changes in the second repository (third and so on), assuming the commit happened in the same branch configured for a given plan branch.  

![Screen Shot 2019-08-23 at 16.06.56.png](https://community.atlassian.com/t5/image/serverpage/image-id/64215i93BE43151B97A3DB/image-dimensions/642x323?v=v2 "Screen Shot 2019-08-23 at 16.06.56.png")

In this screenshot, we have the Plan branch called *bugfix-bugtest*.

* The first repository, *RAP* has the source branch *bugfix-bugtest*
* Second repository, *Repository* initially has the branch *master*, but it can have any available branch for that repository.

Commits in *Repository* (second repo) will only trigger *bugfix-bugtest* if they happen for the branch configured for that repository in *bugfix-bugtest* plan branch.

Does that make it clear why commits on the other repos are not triggering the build? am I missing something?


author: Himanshu Rawat
body: Hi [@Daniel Santos](/t5/user/viewprofilepage/user-id/502125)

Yeah. Now I understood it. Explanation with an example had clear the doubts.

Thanks for it.


author: Daniel Santos
body: That is great!   
Let's crush it =\]


Tags: bitbucket

bitbucket-server

server