How do I setup a VCS trigger in Teamcity to run a build only when files in a certain directory are changed?
Is it possible to set up a VCS trigger in TC for a build such that it can kick off the build if there were changes to the contents of a specific directory on a merge? Say my project structure looks like the following:
/
|_ foo/
|_ bar/
|_ test/
|_ file.txt
|_ baz/
My VCS root is simply configured to point to the root level of the project. In other words, I don't have any custom checkout rules which means that on each build, TC will check out an entire copy of the project. I also configured the VCS checkout mode to Always checkout files on agent and I checked the box to Clean all files in the checkout directory before the build.
Now, I want to create a VCS trigger that sets off a build ONLY when there are any changes to the contents of the /bar/test directory. Given my project structure above, I created a VCS Trigger with the following configurations:
- Checked Trigger a build on each check-in.
- Checked Do not use for the Quiet period mode.
- Added the following Trigger rule:
+:root=MyProject:bar/test/**(here "MyProject" is the name I gave to my root)
Based on all of the documentation that I have read on TC triggers, this should have done the trick. But the actual behavior was not entirely consistent with my expectations be based on my understanding.
In this case, when I merged changes to the foo/ directory, nothing was triggered as expected. If I merged changes to the bar/ directory, however, my build was triggered even though that's not what the rule was configured for.
Some of the rules I've tried with no success are:
+:root=MyProject:**bar/test**+:root=MyProject:**test**+:root=MyProject:/bar/test/**+:**bar/test/**+:**bar/test**+:bar/test/**+:bar/test
I've tried so many different rule variations but no matter what, I still see inconsistencies in the trigger's behavior and I'm at a complete loss as to why this is happening. Has anyone been successful in setting up basic VCS triggers? One of the things that I also don't completely understand is the relationship between the VCS root and a trigger and I feel like I might be misconfiguring something but it's pretty hard to tell.
The version of Teamcity that I'm working with is 2017.1.2 (build 46812)
Please sign in to leave a comment.
Hi,
What you tried first should have worked (if you only have one VCS Root you can omit the root=<name>). Could you send a couple of screenshots with the detailed "changes" tab (including filenames) of the changeset for the build that was triggered on bar/not-test? Also, which kind of VCS root are you using? Git?