'How Do I set a Teamcity Trigger on a Particular Folder for Git VCS trigger
I would like Teamcity to Trigger a build when there is a gerrit change on a specific branch on a specific folder. I'm unable to achieve the same, any suggestions from all you experienced users out there is greatly appreciated.
Following is how my Structure looks like, I want the build to be triggered of both the Branch dev & Staging, any change under New/Folder/My_Content only and not on any other foder , file content
- Branch dev
--Repo
* New/Folder/My_Content
* Folder 2
* Folder 3
* File1.txt
* File1.html
* File1.log
- Branch Staging
--Repo
* New/Folder/My_Content
* Folder 2
* Folder 3
* File1.txt
* File1.html
* File1.log
This is what I have tried
VCS root name: my_root
set on branches
+:refs/(changes/*)
+:refs/heads/dev
+:refs/heads/Staging
VCS Trigger rules:
+:root=my_root:New/Folder/My_Content/**
Branch filter:
+:changes/*
The above rules always trigger builds on everything, on all the folders apart from the one I need.
And the second question I had was, Can I use parameters in the VCS Trigger rules. Something as follows.
VCS Trigger rules:
+:root=my_root:New/Folder/%my_var%/**
Branch filter:
+:changes/*
Solution 1:[1]
You just need to add two VCS Roots for the branches dev
and Staging
you want to trigger and specify the file path you need to trigger.
Detail settings as below:
In Version Control Settings Tab, add two VCS roots separately:
First VCS root name is
<repo URL>+:refs/heads/dev
, default branch isrefs/heads/dev
.Second VCS root name is
<repo URL>+:refs/heads/Staging
, default branch isrefs/heads/Staging
.Below is an example VCS root configuration:
For VCS checkout mode, you can select
Always checkout files on agent
, and select Allow builds in the default branch.In Triggers Tab, set the trigger rule as
+:New/Folder/My_Content/**
.
Solution 2:[2]
There should be a slash after the repo root.
+:root=my_root:/New/Folder/%my_var%/**
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Marina Liu |
Solution 2 | Obsidian |