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.
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
isBuild: true
isDeploySandbox: false
isDeployDevelopment: true
isDeployTest: true
isDeployStage: true
isDeployProduction: false
isPublish: true
isSonar: false
#ETC ...
stages:
- stage: BUILD
displayName: BUILD
pool:
vmImage: 'windows-latest'
jobs:
- template: templates/build/REDACTED.yml
- stage: SANDBOX
displayName: SANDBOX
condition: and(succeeded(), eq(variables.isDeploySandbox, true), eq(variables.isFeature, true))
dependsOn: BUILD```