简体   繁体   English

基于签入到 teamcity 中 GIT 回购中的特定文件夹构建触发器

[英]build trigger based on checkins to specific folder in a GIT repo in teamcity

I have a GIT repo for my project with 2 folders - Client and Server, containing corresponding code in each folder.我的项目有一个 GIT 回购协议,其中包含 2 个文件夹 - 客户端和服务器,每个文件夹中包含相应的代码。 I would like to have two teamcity build procedures, one each for client and server code changes.我想要两个 teamcity 构建过程,一个用于客户端和服务器代码更改。 In the current setup, the entire GIT repo is checked out and built.在当前设置中,整个 GIT 存储库都已检出并构建。 I would like to restrict the client build only to client code changes and server build only to server changes.我想将客户端构建仅限于客户端代码更改,将服务器构建仅限于服务器更改。

One option is to split them to 2 different repos, but this is inconvenient for the developers.一种选择是将它们拆分为 2 个不同的存储库,但这对开发人员来说很不方便。

Is there a way to configure teamcity to listen to changes only on a specific folder?有没有办法将 teamcity 配置为只监听特定文件夹的更改?

You still could split client and server in two repo, and keep the same folder structure for the developers, since both repos could be declared as submodules in the parent repo. 您仍然可以在两个repo中拆分客户端和服务器,并为开发人员保留相同的文件夹结构,因为两个repos都可以在父repo中声明为子模块

And you can setup those submodules in the parent repo in order to follow the latest commits of their respective master branch . 您可以在父仓库中设置这些子模块,以便跟踪其各master分支的最新提交

That way, it is easier for TeamCity to follow only the commits of one specific repo (the client on, or the server one), since partial cloning isn't supported with git. 这样,TeamCity更容易只遵循一个特定仓库(客户端或服务器)的提交,因为git不支持部分克隆。

Within TeamCity ( On Premise at least) there is a way to trigger a build only if a change occurred in a specific (or multiple) subdirectory, which seems to be exactly what you're asking for.TeamCity (至少On Premise下)中,只有在特定(或多个)子目录中发生更改时,才有一种方法可以触发构建,这似乎正是您所要求的。

Using VCS Trigger Rules you can create a Trigger Rule with your VCS Trigger on a build based on a specific (wildcard) path.使用VCS 触发器规则,您可以在基于特定(通配符)路径的构建上使用 VCS 触发器创建触发器规则。 In your example you could create one build with a Trigger Rule for server/** and another build with a Trigger Rule for client/** (assuming these are the directory names in the repository).在您的示例中,您可以为server/**创建一个具有触发规则的构建,为client/**创建另一个具有触发规则的构建(假设这些是存储库中的目录名称)。

Make sure to choose Trigger build as the Rule Type.确保选择Trigger build作为规则类型。 You can add multiple wildcard paths in a single Rule as well, each on a new line.您也可以在单个规则中添加多个通配符路径,每个通配符路径各占一行。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM