Set Azure parameters' value based on conditions

Viewed 36

I got an Azure yaml pipeline which defines a parameter and is being triggered via a change in 2 different paths in the repo:

trigger:
  branches:
    include: 
     - master
  paths:
    include: 
      - "/SomePath1/*"
      - "/SomePath2/*"
parameters:
  - name: SomeFlag
    default: value1 
    type: string

Is there a way for me to tell the pipeline that if it was triggered from "/SomePath1/" then the parameter gets a value of "value1" and if it was triggered from "/SomePath2/" then it will get the "Value2" (without the need to run the pipeline manually of course) ?

1 Answers

Not that I'm aware of. You could do some git magic to see which files were changed...

But if you want this, I'd recommend you create 1 template containing most of your pipeline logic and 2 separate yaml files that reference the shared yml and define a specific trigger for the 2 paths. You can also define your path specific variable in there.

Related