Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,462,856
Community Members
 
Community Events
176
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.

2 answers

1 accepted

0 votes
Answer accepted

In the end I just went with two completely separate plans in Bamboo since this seems to be impossible to resolve in a single plan. One plan follows branches created by Pull Request. The other plan follows branches created by name regex. They are both based on common YAML files for all of the jobs and tasks, the difference between the two being the branch management.

Unfortunately now it means that developers, etc now have two different plans to follow in Bamboo.

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

Atlassian Community Events