Trigger Bamboo merge from another plan
Asked by WET:

I have a Bamboo with `plan1` and `plan2`. On `plan1` I have a branch `master` and `backup`. `backup` has an old status of `master`.

*I want now when I run my* `plan2` *to do there some stuff and afterwords to checkout/merge the* `master` *into* `backup` *and all to be pushed on the origin.* Is this doable?

One more thing, I cannot use the auto mergeable checkbox, because that will mean to merge the `master` branch on `backup` branch every time when I run `plan1` manually.

I tried to find anything on the Bamboo REST API, but nothing seems to be the right thing [Bamboo API](https://developer.atlassian.com/server/bamboo/bamboo-rest-resources/).


Answers:
author: Daniel Santos
body: Hi [@WET](/t5/user/viewprofilepage/user-id/3051055)

I think I'll need more details to really understand what is *plan2* doing in this case.

* Is *plan2* using the same repositories of *plan1*?

If *plan2* is using different repositories, the best course of action seems to be using a script task for this merge and running the checkout/merge commands there. The problem here is that you will need to manage the credentials or add them in the Bamboo agents that need to do the work. If you restrict *plan2*to run only on local agents you would only need to add the right SSH keys in the Bamboo server.

Does that sound like an option for you?

comments: author: WET
body: It's a separat repository. This sounds like the only option, which isn't pretty at all. It's strange that I cannot set a trigger for that.


author: Daniel Santos
body: > It's a separat repository. This sounds like the only option, which isn't pretty at all.

I agree this is not a pretty solution, but I don't see a better option now.  

We have this old (and not very popular, low votes) to create a merge task for git.  
[\[BAM-11552\] Task for merging between git branches.](https://jira.atlassian.com/browse/BAM-11552?jql=project%20%3DBamboo%20%20and%20text~%22merge%20branches%20task%22%20order%20by%20createdDate%20) It should be an option to solve this issue since we already have the **Push** and **Commit** tasks.

> It's strange that I cannot set a trigger for that.

It looks like you have a different idea on how this could work.

* Do you want to create a feature request for the trigger you think Bamboo should have?  
  If that is the case, please give me more details so I can write a feature request for it.


author: WET
body: > It looks like you have a different idea on how this could work.
>
> * Do you want to create a feature request for the trigger you think Bamboo should have?  
>   If that is the case, please give me more details so I can write a feature request for it.

So I know that bamboo has the automated merge, there I would build another option, some radio button maybe -\> default and custom trigger, where default is the exact action as now and the custom trigger you will wait for a signal X, then merge.

Then you can send from another plan (when it builds) a signal X to the initial plan.


author: Daniel Santos
body: Hi [@WET](/t5/user/viewprofilepage/user-id/3051055)

It seems a rather complex implementation for a case that doesn't look common.  

Could it be just an option (like a checkbox) where we can avoid the merge if the build was triggered manually or by a parent (that was also triggered manually)?  

My intention is to add a feature request that has more chances to be implemented and used by other users.