Hi. In `bitbucket-pipelines.yml` I'm trying to reduce duplication by reusing code using YAML anchors:
definitions:
deployment: &deployment
service:
- docker
script:
- |
echo "Debug"
docker version
echo "ENVIRONMENT: $ENVIRONMENT" # <-- here it fails as the variable is not defined.
# more steps, etc.
pipelines:
branches:
my_branch:
- step:
name: Deploy
image: docker:24
deployment: beta
variables:
ENVIRONMENT: beta
<<: *deployment
# There are more similar pipelines for different branches/tags using differnet variables.
This produces working YAML and passes the official validator, but it's not showing the `ENVIRONMENT` value, it acts as if the variable were empty.
What are the possible solutions to this? How to define variables at the pipeline level or at the step level?
Thanks.