3

I'm working on creating build pipeline in Azure DevOps. I want to trigger it against master branch but only when commit has changes under src/Project/tds/Serialization.Master/ Project - this project contains only .item files If the commit includes any other files together with .item then this pipeline shouldn't trigger, tried path exclude

BDD

Scenario 1

Given | I've changes for src/Project/tds/Serialization.Master/*

Then | build pipeline should trigger

Scenario 2

Given | I've changes for src/Project/tds/Serialization.Master/*

And | I've changes for src/Foundation/*

Then | build pipeline shouldn't trigger

Scenario 3

Given | I've changes for src/Foundation/*

Then | build pipeline shouldn't trigger

trigger:
  branches:
   include:
     - master
  paths:
    include:
      - src/Project/tds/Serialization.Master/*
    exclude:
      - src/Foundation/*
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
sumit tandon
  • 51
  • 1
  • 6

1 Answers1

0

Azure build pipeline path filter to only include particular file extension

If want to use path filter to trigger the build for those particular file-extension files in the folder Serialization.Master, you could use following syntax:

trigger:
  paths:
    exclude:
    - src/Foundation/*
    include:
    - src/Project/tds/Serialization.Master/*

You could check the document YAML schema reference for some more details.

Note: Do not forget the keyword paths.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    Its like that only just adding branch filter as path filter can't be used with branch filter, do you think moving paths up and then branch filter will do the trick trigger: branches: include: - master paths: exclude: - src/Foundation/* include: - src/Project/tds/Serialization.Master/* – sumit tandon Aug 28 '20 at 07:03
  • @sumittandon, I do not think moving paths up and then branch filter will do the trick trigger at this moment. – Leo Liu Aug 28 '20 at 07:39
  • is there any wild card solution available ? – sumit tandon Aug 28 '20 at 07:44
  • @sumittandon, please share the complete trigger settings(branch and path), and what is the situation that you want but cannot achieve? Let me try if there are other solutions to this problem – Leo Liu Aug 28 '20 at 07:58
  • i've updated the question. let me know if something is unclear to you – sumit tandon Aug 28 '20 at 08:51
  • @sumittandon, Thanks for you quickly and detail reply. Scenario 1 and scenario 3 are achievable, but scenario 2 cannot be achieved. It is contradictory to Scenario 1 and scenario 3. – Leo Liu Aug 28 '20 at 09:16