Problem to solve
As CI/CD Variables we can assign variables to individual environments. It is not clear how to achieve the same in .gitlab-ci.yaml
Steps to reproduce
As per the given gitlab-ci.yml, given a job that uses parallel matrix or similar means to deploy to multiple environments, one might need different variables to apply to each. It is, however, an error to use $ENV in an extends directive.
Configuration
.environments:
parallel:
matrix:
- ENV: development
- ENV: staging
- ENV: production
.env:development:
variables:
URL: http://dev.example.com
.env:staging:
variables:
APP_URL: http://staging.example.com
.env:production:
variables:
APP_URL: http://example.com
deploy:
extends:
- .environments
- .env:$ENV
environment:
name: $ENV