Using the Azure Devops gui, it is very easy to scope variable groups to pipeline stages. I need to replicate this functionality in a yaml build/release pipeline but I cannot find a way to do it. Anyone found a way to do this yet?
Scope variable groups to pipeline stages functionality in a yaml build/release pipeline
With YAML, the way to achieve that is just specify the Variable group at the stage level to let it available only to this specific stage.
For example, I have a variable group names 1122. And 2 stages: one and two. Now, I want this variable group only available for stage one, which means the stage two should not access its content.
See below simple sample:
stages:
- stage: one
displayName: one
variables:
- group: 1122
jobs:
- job: A
steps:
- bash: echo $(a)
- stage: two
displayName: two
jobs:
- job: A1
steps:
- bash: echo $(a)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With