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.