简体   繁体   English

避免在Teamcity的单个Git存储库下构建多个解决方案

[英]Avoid Building Multiple Solutions Present Under Single Git Repo in Teamcity

Following is our git repo structure 以下是我们的git repo结构

GitRepo
  |
  |-Provisioning
  |        |-Provisioning.sln
  |
  |-Source
  |     |-Deployment.sln

We have created two separate Teamcity projects for Provisioning and Deployment. 我们已经为供应和部署创建了两个单独的Teamcity项目。

  1. Teamcity.Application.Provisioning (Pointing to Provisioning.sln) Teamcity.Application.Provisioning(指向Provisioning.sln)
  2. Teamcity.Application.Deployment (Pointing to Deployment.sln) Teamcity.Application.Deployment(指向Deployment.sln)

In both the teamcity projects we have given the same Git Repo URL in 'Fetch URL' setting while configuring VCS Root. 在两个teamcity项目中,在配置VCS Root时,我们在“获取URL”设置中提供了相同的Git Repo URL。 Now, when we perform CheckIn in 'Source' folder Builds of both the teamcity projects are getting triggered as Git Repo URL is same. 现在,当我们在“源”文件夹中执行CheckIn时,由于Git Repo URL相同,因此将触发两个teamcity项目的构建。

Our expectation is if we perform CheckIn in 'Source' folder only build of Teamcity.Application.Deployment should be trigger. 我们的期望是,如果我们在“源”文件夹中执行CheckIn,则仅应触发Teamcity.Application.Deployment的构建。

Is there any way control this behavior? 有什么办法可以控制这种行为?

Yes, in the 'trigger' part of your build settings, you could specify the relative path to watch (syntax could be done by include or exclude patterns) 是的,在构建设置的“触发”部分,您可以指定要观看的相对路径(语法可以通过包含或排除模式来完成)

https://confluence.jetbrains.com/plugins/servlet/mobile#ConfiguringVCSTriggers-TriggeringaBuildonBranchMerge https://confluence.jetbrains.com/plugins/servlet/mobile#ConfiguringVCSTriggers-TriggeringaBuildonBranchMerge

You can handle this using VCS checkout rules: 您可以使用VCS结帐规则进行处理:

Inside your Build: Provisionning set the checkout rule like this: 在您的内部版本中: Provisionning设置签出规则,如下所示:

+:Provisioning => Provisioning

And inside your Deployment build, you can set the checkout rule like this: 在您的Deployment版本内部,您可以按以下方式设置签出规则:

+:Source => Source

If you need, you can remap your checkout Folder to match your expectations. 如果需要,可以重新映射您的签出文件夹以符合您的期望。

In my case, when I need to do this, I prefere to use some variables to define the checkout Path and modify it a single point: 就我而言,当我需要执行此操作时,我更喜欢使用一些变量来定义checkout路径并对其进行单点修改:

VCS checkout rule : +:%SrcFolder% => %SrcFolder% BuildStep: msbuild %srcFolder%/MyApp.sln So I can share the build configuration to multiple projects using templates. VCS签出规则: +:%SrcFolder% => %SrcFolder% BuildStep: msbuild %srcFolder%/MyApp.sln因此,我可以使用模板将构建配置共享到多个项目。

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

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