With the new CI/CD, I want to select the target environment based on the current branchname.
Eg. cloud/live
goes to live
, cloud/dev
goes to dev
, cloud/my-new-flexible-environment goes
to my-new-flexible-environment
.
I’ve modified the azure-release-pipeline.yml
file to add this stage:
# resolve which environment to deploy to based on triggering branch
- stage: resolveTarget
displayName: Resolve Target Environment
jobs:
- job: setTargetEnvironment
displayName: Set Target Environment Alias
steps:
- script: |
echo "Triggering branch: $(Build.SourceBranchName)"
echo "##vso[task.setvariable variable=targetEnvironment;isOutput=true]$(Build.SourceBranchName)"
name: setTargetEnvironmentAlias
displayName: Set Target Environment Alias
Is there any way I can verify that there actually is an environment with an alias matching my current branch name?