You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.