Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Variable Groups in Azure Devops YAML pipelines

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?

like image 262
user12413265 Avatar asked Apr 17 '26 16:04

user12413265


1 Answers

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)

enter image description here

like image 173
Mengdi Liang Avatar answered Apr 22 '26 20:04

Mengdi Liang



Donate For Us

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