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,463,987
Community Members
 
Community Events
176
Community Groups

With bamboo-specs yaml is it possible to have a base deployment and merge yaml maps?

I have multiple environments I deploy a project to where the only difference in the deployment are the variables associated and the triggers.

How can I specify a base deployment job and use the merge keys feature in the yaml-specs reader together?

What I want to achieve would be this.

---
version: 2
deployment:
name: Multi-env deployment
source-plan: MY-PROJ
release-naming:
version-name: release-1
environments:
- ENV-A
- ENV-B
- ENV-C

BASE: &deploy
tasks:
- clean
- script
interpreter: SHELL
scripts:
- echo ${bamboo_ENV_SPECIFIC}
variables: &base-variables
foo: bar
fiz: baz

ENV-A:
<<: *deploy
variables:
<<: *base-variables
ENV_SPECIFIC: A

ENV-B:
<<: *deploy
variables:
<<: *base-variables
ENV_SPECIFIC: B

ENV-C:
<<: *deploy
variables:
<<: *base-variables
ENV_SPECIFIC: C

But I get validation errors saying that BASE is an unused variable. Is my only option to move BASE into ENV-A?

1 answer

1 accepted

0 votes
Answer accepted
Eduardo A Atlassian Team Aug 04, 2022

Hello @Jay Barra Welcome to Atlassian Community!

Bamboo will expect all declared variables to be used. That's part of the YAML optimisation.

Considering "ENV-A" is your "template" environment. You can use the following to achieve the same results:

---
version: 2

deployment:
  name: Multi-env deployment
  source-plan: DEF-DEF

release-naming:
  next-version-name: release-1

environments:
  - ENV-A
  - ENV-B
  - ENV-C

ENV-A:
  tasks: &base-tasks
  - clean
  - script:
      interpreter: SHELL
      scripts:
      - echo ${bamboo_ENV_SPECIFIC}
      description: test
  variables: &base-variables
    ENV_SPECIFIC: A
    foo: bar
    fiz: baz

ENV-B:
  tasks: *base-tasks
  variables:
    <<: *base-variables
    ENV_SPECIFIC: B

ENV-C:
  tasks: *base-tasks
  variables:
    <<: *base-variables
    ENV_SPECIFIC: C


Kind Regards,

Eduardo Alvarenga
Atlassian SupporT APAC

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events