0

Somehow I'm not getting how I can exclude updates yaml pipelines from trigger the pipelines themselves. I have tried some wildcards as described here both in the include item (with the ! operator) or in the exclude item and nothing worked. I've added the plain pipeline names with no wildcards in the excluded item and again it did not work. The yaml files sit in the root of my repository (no containing folder).

These don't work

trigger:
    branches:
        include:
        - MyBranch
    paths:
        exclude:
        - "*.yml"
        - "**/*.yml"

Clearly adding the full name of the pipeline works but you can't always edit exisitng yaml files each and every time you add a new one

whatever
  • 2,492
  • 6
  • 30
  • 42
  • Can you provide the trigger portion of the yaml here – Mani Dec 10 '20 at 06:27
  • Edited my initial question, also see my answer below. It seems that using the same wildcards with the not operator in the include section is effective – whatever Dec 10 '20 at 11:07

2 Answers2

0

If you don’t want to trigger the pipeline when updating azure-pipelines.yml file, you can set the following trigger:

trigger:
  branches:
    include:
    - master
  paths:
    exclude:
    - /azure-pipelines.yml
Hugh Lin
  • 17,829
  • 2
  • 21
  • 25
  • That also works but intellisense is misleading, it underlines that path, the staring slash seems to lead it to expect some reg ex expression – whatever Dec 10 '20 at 10:51
  • Using this approach would not be effective, you can't go edit all yaml files each an every time you add a new one to the monitored branches – whatever Dec 10 '20 at 11:11
0

I'm confused, with the following syntax CI pipelines are not triggered when updating *.yml files

trigger:
    branches:
        include:
        - MyBranch
    paths:
        include:
          - '!**/*.yml'

while with the following one (which as I understand it should mean the same thing as the above one) pipelines keep being triggered when updating any *.yml file

trigger:
    branches:
        include:
        - MyBranch
    paths:
        exclude:
          - "**/*.yml"

What am I not getting?

whatever
  • 2,492
  • 6
  • 30
  • 42
  • ok, so this does not really work as CI pipelines are not getting triggered now even when non-yaml files are being updated – whatever Dec 10 '20 at 11:46
  • I suppose the only viable solution is to place pipelines in a folder and exclude that folder – whatever Dec 10 '20 at 11:46
  • Thanks for sharing your answer here, would you please accept your answer as the answer? So it would be helpful for other members who get the same issue to find the solution easily. Have a nice day:) – Hugh Lin Dec 18 '20 at 08:10