If I have multiple repositories (say of type Stash) added to a Bamboo Build plan and a repository polling trigger defined with more than one repository selected, is there a way to find in bamboo which repository commit triggered the build ?
Yes, you can do that. Use the below query to get the desired result.
NAME AS 'Repository Name',
COMMIT_COMMENT_CLOB AS COMMIT_COMMENT,
a.BUILDRESULTSUMMARY_ID = b.BUILDRESULTSUMMARY_ID
AND e.vcs_location_id = d.vcs_location_id
AND f.COMMIT_REVISION = d.CHANGESET_ID
AND f.REPOSITORY_CHANGESET_ID = d.REPOSITORY_CHANGESET_ID
AND f.REPOSITORY_CHANGESET_ID = b.REPOSITORY_CHANGESET_ID
AND g.author_id = f.author_id
AND c.commit_id = f.commit_id;
Please note: The above query is built for MYSQL and you may have to change the syntax if any other database.
Please accept the answer if you find it's useful so that others can also take benefit from it.
There is a Bamboo generic repository variable "bamboo.planRepository.<position>.name" which could give you the name of the repository but it will always give you the name of the default linked repository to the plan.
Moreover, looking at your first question - "is there a way to find in bamboo which repository commit triggered the build ?"
Let's say you have 2 repo's "RepoA" and RepoB" and you commit changes to "RepoB" then, in this case, the complete build plan will be triggered because we have a repository polling trigger.
But, if the source code checkout task in the plan configuration is configured to use the "RepoA" then this question is not valid in this case because you commit changes to the "RepoB" and the "RepoA" is being checked out or else if you have multiple tasks to checkout multiple repositories then they all will be triggered by bamboo for checkout because the entire build plan is triggered.
G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events