Reputation: 175
I have 2 pipelines currently one is linked to my dev branch and one is linked to my master branch. But both the YAML files have the same name but have different scripts within it so the problem is when I merge my dev into my production branch it changes the yaml file inside the master brance. Is there a workaround this?
Upvotes: 1
Views: 3277
Reputation: 51073
You could rename the YAML file. It's able create as many build configurations using different yaml files. Just set corresponding trigger for each branch.
Multiple YAML build pipelines in Azure DevOps
If you want to use a single YAML file to cover this. Just as Daniel point out: Use a template parameter as part of a condition
Templates let you define reusable content, logic, and parameters. Templates function in two ways. You can insert reusable content with a template or you can use a template to control what is allowed in a pipeline.
Parameter expansion happens before conditions are considered, so you can embed parameters inside conditions. The script in this YAML file will run because parameters.doThing is true.
parameters:
doThing: false
steps:
- script: echo I did a thing
condition: and(succeeded(), eq('${{ parameters.doThing }}', true))
More details please take a look at our official doc here:
Upvotes: 1