Trigger Rules folder question
Hi,
We are trying to establish a set of trigger rules that will exclude builds if files are ONLY changed in a specific folder.
As an example, we have a /docs folder for our documentation and other subfolders with source code. We want to trigger a build unless the ONLY files that are changed are in the /docs folder (ie if a commit has changes in /docs and /src, we want to trigger that; but if its just in /docs we do not want to trigger that)
How would we go about writing a trigger rule for this?
Please sign in to leave a comment.
You should be able to achieve this by just excluding the docs directory in the trigger rule. This way, changes to the docs directory will not trigger the build, but changes to other directories (like if a commit has changes in both docs and other directories) will. Please refer to the documentation regarding the trigger rules: https://www.jetbrains.com/help/teamcity/configuring-vcs-triggers.html#vcs-trigger-rules-1.
Best regards,
Anton
Hi Anton,
Thanks for the response - I gave this a test and it seems to work as expected (the docs were not super clear to me but perhaps thats my fault for how I was interpreting/reading them)
One thing I have noticed is that despite the trigger rules, we still end up with some builds being triggered, almost like some of them randomly do not respect the trigger rule. As an example, I added a rule as such on our base configuration:
and opened a PR with the following files
However, I can see that TeamCity still triggered 4 builds which have this above rule set (noting we have ~20 build configurations; most of them which have this rule were NOT triggered, but these ones still were)
I have noticed this inconsistency in TeamCity a bit, where most of the time, trigger rule exclusions are respected (as you can see we have one that looks for #nobuild in the commit comment - this is the same, most of the time its respected, other times its randomly not).
Are the build triggers unreliable in this sense?
No, the trigger rule should be reliable in that sense, so I assume that something in the configuration allows the described automatic triggering. Please share the following to check:
1. Version Control Settings.
2. VCS Root settings.
3. All the setup triggers settings.
4. Pull Request build feature settings (I assume you use it if you are building PRs).
You can upload it via https://uploads.jetbrains.com/ and share the upload ID to share it confidentially.
I also think it shouldn't be random. Does such a PR trigger these build configurations all the time?
Best regards,
Anton