I am new to YAML deployment templates in Azure DevOps. Sorry if this question is very basic.
I just stared working with a team that has the YAML like the snippet shown below. The team changes the isDeployStageName: values such as isDeploySandbox or isDeployProduction from false to true to indicate which environment to deploy to. It results in a lot of modification of the azure-pipelines.yml being changed with pretty much every build and it feels error prone (if someone forgets to set a value back to false for example).
My question:
Is there a better way to do this with YAML deployment templates? I’m wondering if there’s a way to control where deployments go without the flags technique.
Build once & deploy many, then you can get rid of most of those booleans. You can set a single variable that determines how far a build goes into the pipeline, and set a conditional on each stage to check if the previous stage succeeded and if the stage sufficiently meets that flag criteria
This one is simple, but somewhere else (can’t remember where) we have it like:
• anything - tests run
• test-anything - tests run & deployed to testing
• test-1.2.3 - test run & deployed to testing & staging
• 1.2.3 - test run & deployed to testing & staging & production
My situation is also simple and is resolved with one boolean (either it builds or it builds & deploys). However, it could be changed to a different indicator. We have other checks around the production stage to not allow feature branches enter that stage regardless of what the user enters into the pipeline parameters.
We use environments with approvals as well as branch conditions. Prod deployment stages only trigger on master branch and only after manual approval. Dev deployment stages also trigger on pull requests and can optionally have manual approval on the environment if necessary. No need for tags, bools or anything.