Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger CI Build only on changes to subfolder in VSTS (was TFS Online), using Git

I have a Git repo with two subfolders in Visual Studio Team Services. One is HelloWorld, the other ST. The path shows as this on my local folder.

root /HelloWorld /HelloWorld /ST

Under HelloWorld is a C# app. Under ST is a basic set of DB scripts.

I want to build with CI each of these separately. I have a build for HelloWorld and one for ST, each working independently. If I commit changes with git and push, the builds run successfully. Meaning, if I commit a C# change from VS, the ST database build will run, then the c#, VS solution build runs. If I commit and push a db change, same thing. Both builds run.

However, if I use the new path filters in VSTS, and add a filter for the ST build with either of these:

  • include "ST"
  • exclude "HelloWorld"

And commit a change in either folder, the ST build will not run.

Likewise, if I add a filter to the HelloWorld build, include or exclude, that build will not run.

I've tried paths like:

  • /HelloWorld
  • HelloWorld/*
  • HelloWorld/HelloWorld
  • HelloWorld/HelloWorld/*
  • H*
  • /H*

A few more combinations, to either build. If I use any path filter, things won't trigger a build. A manual build works fine, no matter what the filters.

Am I missing something or are path filters broken?

like image 294
way0utwest Avatar asked Jul 17 '16 22:07

way0utwest


People also ask

How do you trigger a build on Azure DevOps pull request?

Create a pull request trigger You can set up pull request triggers for both Azure Repos or GitHub repositories. From within your project, Select Pipelines > Releases, and then select your release pipeline. Under the Pull request trigger section, select the toggle button to enable it.

How many types of triggers in Azure DevOps?

Broadly speaking, there are three types of Azure Pipeline Triggers: Resource Triggers. Webhook Triggers. Schedule Triggers.


1 Answers

I'm not sure the folder structure of your project in TFS/VSTS, so I create a sample project for your reference, following is the folder structure: enter image description here

The build will be triggered when there is change pushed into the fist "HelloWorld" folder and the change pushed into "ST" folder will not trigger the build with following settings: enter image description here

The build will be only triggered when there is change pushed into "ST" folder: enter image description here

Please check your folder structure from the "Code" tab first and then update the setting of your build definition.

like image 163
Eddie Chen - MSFT Avatar answered Sep 21 '22 15:09

Eddie Chen - MSFT