Azure Devops Path Exclude trigger that does NOT seem to be working as documented

Viewed 97

I have the following trigger defined in an "azure-pipelines.yaml" definition

trigger:
  batch: true
  branches:
    include:
    - master
  paths:
    exclude:
    - config/luna-tenant-bio-annotation-prod.yaml
    - azure-pipelines-prod.yaml

but When changes are made to the azure-pipelines-prod.yaml listed in "exclude" a new CI is still started for this build definition.

I'm trying to have a separate pipeline for our production code to do a few extra steps but the regular environment is still triggering on changes to prod only updates which is causing duplicate updates.

Thankfully the inverse is not happening as I have excludes for the dev, test, stage environments in the azure-pipelines-prod.yaml trigger and it is working as expected.

I even tried to override the "YAML triggers" in the pipeline definition but it still is starting this pipeline on any change to the master branch and seems to be ignoring the "paths:" section

what do I have wrong????

2 Answers

I copied your yaml and it works fine on my side. Please follow below options:

  1. Check if you have used UI trigger on yaml pipeline (master branch) to overwrite the current setting. Remove the UI trigger if it exists.

enter image description here

  1. Check if you have same yaml name azure-pipelines.yaml between different branches(eg: master, dev, test). If so, change the yaml file name in master branch, edit the pipeline to use the new yaml.

  2. If the issue persists, there could some issues on the pipeline, it's recommended to delete the current pipeline, recreate it for a quick fix.

I had this exact same issue. Turns out having the same file name for the pipeline was the issue all along.

Main.yml was the name of my pipeline in my main branch, in my dev branch it was also called main.yml. As soon as I renamed this to dev-main.yml, all the triggers worked as intended.

Related