拉取请求的 Team Foundation Server 2013 触发器构建

Team Foundation Server 2013 trigger build for pull request

如何将 TFS 配置为 运行 每个拉取请求(创建和更新时)的构建(CI 构建)。

我想要的场景是,当开发人员完成其工作并将分支推送到 GIT(在 TFS 上)时,最好检查构建是否实际编译以及所有测试正在路过。

我可以为存在的分支创建一个构建并监视那里的更改,但是如何为稍后创建的分支配置它以及如何在创建拉取请求时触发这个构建。

您可以在分支名称中使用通配符。因此,如果您在服务器上使用命名模式创建拉取请求分支,例如 "pr-myrequest",您可以将其添加到服务器的 CI 设置中:

这个话题有点模糊 in the guidance on MSDN

Git: Specify the repository and the branches that contain the files that your build process requires.

Tip


In the list of branches monitored for continuous integration (CI) and rolling builds, you can use wildcards. For example, you could specify refs/heads/feature* to monitor the refs/heads/featureA and refs/heads/featureB branches.

您可以在分支命名中使用/,这可能会提供一种清晰的分支命名方式。这将导致:refs/heads/pr/* 作为一个 include 并且你的分支名称必须以 pr/branchname 为前缀才能自动构建。

如果您使用的是 TFS 2015 更新 2.1,则需要转到团队项目设置,然后 select 版本控制下的分支策略。