I have a question about deploying to different environments (Test / Production) with one pipeline.
In this scenario I have a test and production environment. With the same configuration for deploying web application to Azure for two countries. In the current situation we have a release pipeline in the production and test with two stages. One stage for country A and one stage for country B.
What I did is as follows:
- I created an variable group (with Azure key vault).
- I created an deployment YAML file for my stages / steps.
- In that deployment YAML file I am reffering to the variables.yml file.
- My deployment YAML file has two stages.
- First stage for country A
- Second stage for country B
- Both of the stages are using the same steps but different description and CosmosDB container etc..
What I want to do is:
- Using one stage in the deployment YAML.
- Using two variables.yml, one for each country.
- Depending on wether it is country A or B, pointing to the correct variables.yml file so it can make use of the correct values.
The same goes for the production and test environment. depending on the environment, I want to be able to point to the correct YAML variables.yml.
How can I achieve this?
Unclear what obstructed your design pipeline, however, based on your current requirements, the YAML pipeline structure was straightforward. Since you have two variables template
.yml
files, you can import diffrent templates in respective deployment jobs and each deployment can be configured to run against its corresponding environment.Even though the variable names in each template are the same, since the two templates
variablesA.yml
andvariablesB.yml
work for respective deployment job scope, the variable values are different during runtime.