Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,203
Community Members
 
Community Events
165
Community Groups

How to override branch builds strategy from single yaml spec?

Edited

I asked this under https://community.atlassian.com/t5/Bamboo-questions/Different-merging-strategy-for-release-branches-in-Bamboo-Specs/qaq-p/1469251, but didn't get any answer, so I'll ask this again as a specific question.

How can I define an override for branches so that specifically name branches get a different branch plan creation/merge strategy than the default?

I have a generic plan in Bamboo Yaml specs with normal development branches being created by pull-request with a specific merge strategy that is used for running tests. But we also have release branches that are branched periodically and track a production release. These release branches are created as a specifically named branch and never merge to master. I would like Bamboo to automatically create branch plans for these as well and to run the tests, only without the merge to master. If this was a manual Bamboo job then I could live with the default option, and someone can manually create a new release branch with different merge strategy.

Now that we have Yaml specs we cannot continue with this manual process for release branches given that having a spec disables creating branch plans.

I see that I can have branch overrides, and I have implemented that according to how I understand it should be, but it doesn't do anything.

branches:
create: for-pull-request
delete:
after-deleted-days: 0
after-inactive-days: 10
integration:
push-on-success: false
merge-from: core-build
link-to-jira: true
branch-overrides:
-
^test_.*$:
branch-config:
create:
for-new-branch: ^test_.*$
delete:
after-deleted-days: 0
after-inactive-days: 10
link-to-jira: true

I create a branch in git matching the regex (i.e test_mybranch), but I still don't get any branch appearing automatically. The only branches that appear are those coming from pull-requests.

1 answer

Actually I think I am barking up completely the wrong tree here since I now realise that the branch-overrides only allow overriding the branch-config. But now from the documentation it is completely unclear what the relationship is between the main bamboo specs and any particular branch. So just what does branch-config, actually even do?

I want to provide a single bamboo spec file in master. And any time a developer creates a branch, I want that this bamboo spec already contains all the rules about what those branches should do without requiring any further action.

But nothing works.

Every single variation that I can think of usually results in either a spec that cannot be parsed, or an error that says things like

Document structure is incorrect: Found following unused properties: branch-config / create, branch-config / delete, branch-config / link-to-jira.

Every property must have a correct key recognizable by Bamboo and must be used as part of the configuration in the current YAML document. Common sources of these problems are typos in properties keys, unused jobs, and mixing a plan and its permissions configuration in one YAML document.

Surely there is some way to override the default branch behaviour based on the branch name?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

957 views 3 8
Read article

Community Events

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

Events near you