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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

Combine includes and anchors in yaml specs




Im trying to setup a base plan via yaml specs which should be used to create actual plans via includes. So I have created several files which are included in a test plan like this:

version: 2
  project-key: SOMEPROJECT
  name: Test Plan
  description: deploy to target

notifications: !include 'base-notifications.yaml'
repositories: !include 'base-repositories.yaml'


Im trying to do the same for the plan variables that all plans that are going to use this as base should include, but the actual plans should also be able to add some additional vars or overwrite existing ones.

The file named base-variables.yaml has an example content like this:

  somevar: somevalue
  anothervar: anothervalue

I have tried a lot of different ways to achieve this but it seems that its not possible to do something like this:

variables: !include 'base-variables.yaml'
<<: { additional-var, additional-value }

This results in the below error:

27-Sep-2022 07:22:46	Bamboo YAML import failed: Invalid format of the YAML file: while parsing a block mapping
27-Sep-2022 07:22:46	 in 'reader', line 2, column 1:
27-Sep-2022 07:22:46	    version: 2
27-Sep-2022 07:22:46	    ^
27-Sep-2022 07:22:46	expected <block end>, but found '<block mapping start>'
27-Sep-2022 07:22:46	 in 'reader', line 10, column 3:
27-Sep-2022 07:22:46	      <<: { additional-var: additional-value } 
27-Sep-2022 07:22:46	      ^
27-Sep-2022 07:22:46	

Also tried something like this:

base-variables: &basevars !include 'base-variables.yaml'
plan-specific-vars: &planvars
somekey: somevalue

<<: *basevars
<<: *planvars

But that caused an issue because the properties base-variables and plan-specific-vars are not actually used.

How can I achieve the described outcome without having to list all variables in all plans?

1 answer

0 votes
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 27, 2022

Hello @margo

Welcome to Atlassian Community!

Nested includes are not available in Bamboo. They are tracked by the following feature request:

Make sure to vote and to follow that Feature Request so you can be notified when it moves forward.

As a workaround, you can use Anchors and Aliases to avoid duplicated code.

ENV-A: &defaults
tasks: &tasks
- clean
- script:
interpreter: SHELL
- echo ${bamboo_ENV_SPECIFIC}
- echo this is Repo1
description: test
variables: &vars
foo: bar
fiz: baz

# Uses the same subset from ENV-A (defaults) and declares
# extra variables and overwrites others
<<: *defaults
<<: *vars
foo: yeah
CUSTOM_VAR_1: abc123
GOOD: bye
HeLLo: World


Eduardo Alvarenga

Atlassian Support APAC

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

The problem with that workaround is that I do not have a deployment project, its just a build project, so there are no environments.

As mentioned in my original question I already tried several different approaches to use anchors with includes but none of them was working.

Any idea how to get this done when variables has to be on the first level of the yaml document, not nested in an environment?

@Eduardo Alvarenga any idea how to achieve the above mentioned case when the variables property has to be on the first level of the yaml document and is not nested in an environment?

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 02, 2022

Hello @margo

Unfortunately Bamboo will not support nested includes and base-level include assignments at this stage. These are documented on the following Feature requests:

We encourage you to add yourself as a watcher to be kept informed as to the state of the feature request moving forward and also vote on it.


There are a number of factors that determine how Atlassian prioritizes the Implementation of new features.

Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

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

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events