1
votes

I've configured vcs trigger to monitor only specific directory like this "+:SomeDirectory/**" and it was working fine when my VCS root had 1 branch configured. Recently I've made a change and configured VCS root to listen on multiple branches.

I've got feature branches based on main develop branch and i wanted to trigger build only if specific directory has been changed. Unfortunately with this configuration teamcity triggers additional build for every brand new feature branch (it assumes that it's new branch thus there are changes in directory). So i have 2 builds: if anything changed in this directory and build if branch is new.

Is it possible to trigger build on feature branches only if something changed in "someDirectory" according to my main development branch?

1
Yes, it's possible. The same window where you configure the directory filter, on the bottom, you should also see an option for specifying a "Branch Filter"Ben Richards
I configured branch specification in vcs root and it's buidling only desired branches. What and why do i need to configure in branch filter?Pawel
Try the following internal property teamcity.vcsTrigger.runBuildOnSameRevisionInEveryBranch=false (see the comment).Alina Mishina

1 Answers

2
votes

Yes, you do this by adding a VCS Trigger at the Trigger configuration page, where you can specify, among others, the "Branch Filter". Here you can also create VCS Trigger Rules, where you can specify which "VCS root" will trigger the build, for which directories.

Please note that the VCS Checkout Rules might influence the paths used in the VCS Trigger Rule!

E.g. consider having two VCS Roots attached to the build configuration, with checkout rules:

master-vcs-root  +:. => master
feature-vcs-root +:. => feature

So the master-vcs-root checks out into [agentpath]/master, and the feature-vcs-root checks out into [agentpath]/feature.

If we only want the trigger fired based on changes made in a specific directory on the feature-vcs-root, the Trigger Rule should take the checkout directory into account:

+:root=feature-vcs-root:feature/someDirectory/*

and not

+:root=feature-vcs-root:someDirectory/*

This was found working on TeamCity Professional 2017.2.2 (build 50909).