Azure DevOps yaml trigger pipeline

Viewed 4

Is there a way to trigger a pipeline if particular variables yaml file is updated in Azure Source Control and use exactly that updated variables yaml file values? I know how to gather values from variables yaml, but I can not figure out how to get the main pipeline to use exactly that particular variables yaml file. Example, folders hierarchy in SC:

Variables
  var1.yaml
  var2.yaml
  var3.yaml

My main pipeline just a draft:

trigger:
  batch: true
  branches:
    include:
    - master
  paths:
    include:
      - variables/var*

pool:
  vmImage: ubuntu-latest

stages:       
  - stage: stage1
    displayName: 'My stage'
    jobs:
      - job: Job 1
        displayName: 'Run something'
        variables:
          - template: ../variables/...(not sure about this part yet)
        steps:
          - task: PowerShell@2
            displayName: 'Run PoSH command'
            inputs:
              targetType: 'inline'
              script: | 
                write-host '${{ variables.varx }}' (again not sure here yet)

Basically, is there a logic how to run main pipeline, based by the variables yaml template which has triggered the main pipeline. There will be many variables yaml files in SC, and once particular yaml, example var2.yaml is updated, the main pipeline gets triggered and uses var2.yaml values.

0 Answers
Related