Bamboo Tag Trigger for Multiple Repositories.
Asked by fnc11:

I am working on a task where we want to create a release branch from the master, as soon as a release tag is pushed to the master branch. This process is working for a single repository.

Now I want to include multiple repositories in this plan, and based on the tag pushed to the master branch of one of the repositories I want to create a release branch for that repository. And do some further tasks if necessary, like removing -SNAPSHOT in case of maven projects.

So I have the following questions:

1. First how to make tag trigger work for multiple repos.
2. I am thinking that [this is the only](https://community.atlassian.com/t5/Bamboo-questions/Determine-which-Repo-triggered-a-build/qaq-p/1108462?utm_source=atlcomm&utm_medium=email&utm_campaign=immediate_general_reply&utm_content=topic) option to retrieve the repository name for which the plan got triggered. If there is any simpler way, please let me know.
3. Retrieving tag also.
4. Since the plan has multiple repos, how the tag trigger will work if I release v1.3 for repo1 and later v1.3 for some other repo2. I ask this since the tag trigger only works for new tags.


Answers:
author: Eduardo Alvarenga
body: Hello [@fnc11](/t5/user/viewprofilepage/user-id/5124437)

You are on the spot!

We have a KB article that explains pretty much that community post you have referred to:

* [How to identify which repository triggered a build](https://confluence.atlassian.com/bamkb/how-to-identify-which-repository-triggered-a-build-1093015126.html)

To find the last tag of a repository you can run after checking it out:

    git describe --tags --abbrev=0

Regarding multiple similar tags across different repositories, as long as they are new but have different revisions on different repositories, Bamboo will identify them all and trigger the builds.

Kind regards,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**

comments: author: fnc11
body: Thanks [@Eduardo Alvarenga](/t5/user/viewprofilepage/user-id/4365410) , but this is not the complete solution. The tag trigger is not working for all the repositories. It's working only for the default repository.  

And what I meant by retrieving tag, is to have it as a variable in the build, to be used for release branches like release/1.3.

And while we are on the topic, is it possible to have one default job which gets activated to identify the repo and tag and then runs different jobs on the basis of that information?


author: Eduardo Alvarenga
body: Hey [@fnc11](/t5/user/viewprofilepage/user-id/5124437) apologies for that. You are right. Tag triggers will only work on the default repository.

I would suggest you create individual Plans that would be used exclusively as "Launchers" and add individual "default" repositories on each of them along with a Tag trigger.

Then, once Bamboo detects the new tag on a repository, it will start a "launcher" build that can trigger the "real" plan -- that "real" plan doesn't need to have any configured triggers as it will always be invoked by the "launcher" plan.

To trigger a Plan from another Plan, the "Launcher" plan can make use of [Dependencies (Child Plan)](https://confluence.atlassian.com/bamboo/setting-up-plan-build-dependencies-289276887.html) or REST API calls over a Script Task to trigger the plans independently (that's a good case if you need to pass build parameters to that plan such as variables, specific stages, custom revision, etc.

* <https://developer.atlassian.com/server/bamboo/rest/api-group-api/#api-api-latest-queue-projectkey-buildkey-post>

Variables can be injected by an "[Inject Bamboo variables](https://confluence.atlassian.com/bamboo/configuring-a-variables-task-687213475.html)" task within a Job. Those variables need to be loaded from a java properties file (key=value format). So you can run a command to extract the tag name you need, add it to a file tag=*value* and call another Inject Bamboo variables task to load it as a variable and pass it over to the next task or Stage (if applicable).

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC  
**--please don't forget to Accept the answer if the reply is helpful--**


Tags: bitbucket