2

在我们的 TFS2018 网站上,我为我们的开发分支和发布分支定义了构建定义。发布分支具有以下命名约定:Release_yyyy_mm_dd。

DEV Branch
|
 -- Release Folder
|   |
|   -- Release_2018_01_01 Branch
|   -- Release_2018_01_15 Branch
|   -- Release_2018_01_29 Branch *current*

我们有很多需要构建的代码(MAP文件夹)和很多不需要构建的代码(CLOAK文件夹)。

例如:

MAP Release_2018_02_22\ServiceA  
MAP Release_2018_02_22\ServiceB  
CLOAK Release_2018_02_22\ServiceC  
CLOAK Release_2018_02_22\GigsOfDataThatDoesntNeedGetting  
*repeat this for 50 folders*

我们每次 sprint 都会发布,所以我每次都必须调整发布分支文件夹。这就是我引入构建变量 $(CurrentReleaseBranch) 的原因。

例如:

$(CurrentReleaseBranch) on the variables TAB set to "Release_2018_02_22".  
MAP $(CurrentReleaseBranch)\ServiceA  
MAP $(CurrentReleaseBranch)\ServiceB  
CLOAK $(CurrentReleaseBranch)\ServiceC  
CLOAK $(CurrentReleaseBranch)\GigsOfDataThatDoesntNeedGetting  
*repeat this for 50 folders*

我在此构建定义上有一个门控签入触发器,并选中了使用工作区映射进行过滤器选项。在此分支上签入代码时,不会显示门控签入。
当我在映射中使用硬编码路径时,门控签入对话框确实出现在 Visual Studio 中。
我怎样才能使用变量并且仍然有门控签到?

4

1 回答 1

1

你不能。不支持路径映射中的变量。如果您需要以这种方式支持许多不同的分支,最简单的选择是使用脚本语言(如 PowerShell)和 REST API 的组合自动化您想要执行的操作,以克隆/更新构建定义 JSON。

于 2018-02-19T14:29:52.410 回答