当我的 TFS 构建由特定于分支的签入触发时,为什么不将该分支设置为其源? [英] When my TFS build is triggered by a branch-specific check-in, why doesn't it set that branch as its source?

查看:21
本文介绍了当我的 TFS 构建由特定于分支的签入触发时,为什么不将该分支设置为其源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是创建一个 TFS CI 构建,该构建由在 TFVC 中托管的项目的两个特定分支上的签入触发.当我手动将构建排队并在队列提示的货架集名称"字段中键入特定分支时,构建按预期工作.但是,当我从一个特定分支检入更改时,构建会尝试使用两个分支的父文件夹作为其默认源,从而导致在我使用 $(Build.SourceBranchName) 变量.

我的文件夹结构如下:

- $/MyRepo||-集成套件||-当前版本||-Dev

我使用路径过滤器打开 CI 触发器以包含 $/MyRepo/Integration Suite/CurrentVersion$/MyRepo/Integration Suite/Dev

在Get Sources"任务中,我的存储库设置为 $/MyRepo,我将这些服务器路径映射到 CurrentVersionDev 本地路径,分别.

例如,我希望在 CurrentVersion 分支下检查更改会将构建源设置为 $/MyRepo/Integration Suite/CurrentVersion,但是相反,它被设置为 $/MyRepo/Integration Suite.这意味着我在定义中使用 $(Build.SourceBranchName) 构建的任何路径都具有 Integration Suite,而它们应该具有 CurrentVersion.

我做错了吗?还是不支持我想要的行为?

解决方案

TFVC 依赖工作区映射来了解要下载的内容.工作区映射可以包含跨不同团队项目的多个 TFVC 存储库、单个存储库中的多个分支,基本上,无论您想要什么.因此,它无法理解如何针对特定分支动态更改工作区映射.

TFVC 构建的可悲现实是您需要为每个分支构建一个.这使得 TFVC...呃...对于许多常见的持续交付场景来说不是很好.

My goal is to create a TFS CI Build that is triggered by check-ins on two specific branches of a project, hosted in TFVC. When I queue the build manually and type a specific branch in the "Shelveset name" field of the queue prompt, the build works as intended. However, when I check in changes from one specific branch, the build attempts to use the parent folder of the two branches as its default source, resulting in incorrect file paths throughout the build definition wherever I use the $(Build.SourceBranchName) variable.

My folder structure is as follows:

- $/MyRepo
|
| -Integration Suite
  |
  | -CurrentVersion
  |
  | -Dev

I have CI triggers turned on with path filters to include $/MyRepo/Integration Suite/CurrentVersion and $/MyRepo/Integration Suite/Dev

In the "Get Sources" task, my repository is set to $/MyRepo, and I map these server paths to the CurrentVersion and Dev local paths, respectively.

I would expect, for example, that checking in changes under the CurrentVersion branch would set the source of the build to $/MyRepo/Integration Suite/CurrentVersion, but instead it is set to $/MyRepo/Integration Suite. This means that any paths I build in the definition with $(Build.SourceBranchName) have Integration Suite where they should instead have CurrentVersion.

Am I doing something wrong? Or is my desired behavior not supported?

解决方案

TFVC relies on workspace mappings to know what to download. The workspace mappings can encompass multiple TFVC repos across different team projects, multiple branches within a single repository, basically, whatever your heart desires. As a result, there's no way for it to understand how to dynamically change workspace mappings to be for a specific branch.

The sad reality of TFVC builds is that you need one build for every branch. This makes TFVC... er... not great for many common continuous delivery scenarios.

这篇关于当我的 TFS 构建由特定于分支的签入触发时,为什么不将该分支设置为其源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆