TFSBuild:如何仅在签入特定文件时触发构建?

发布于 2024-08-03 12:53:24 字数 212 浏览 6 评论 0原文

我们有一个特定的文件,例如 X.zip,仅由 1 或 2 个人修改。因此,我们不希望每次签入时都触发构建,因为其他文件大多未受影响。

我需要在构建之前检查条件,签入的项目是否为“X.zip”。如果是,则触发构建,否则不触发构建。我们只使用 CI 构建。

知道如何仅在签入此特定文件时触发构建吗?任何其他方法将不胜感激,因为我是 TFS 的新手......

塔拉。

We have a particular file, say X.zip that is only modified by 1 or 2 people. Hence we don't want the build to trigger on every check-in, as the other files are mostly untouched.

I need to check for a condition prior to building, whether the checked-in item is "X.zip" or not.. if yes, then trigger a build, else don't. We use only CI builds.

Any idea on how to trigger the build only when this particular file is checked-in? Any other approaches would be greatly appreciated as i am a newbie in TFS...

Tara.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

○愚か者の日 2024-08-10 12:53:24

我不知道有任何 OOTB 功能可以做到这一点,您需要做的是编写自己的自定义 MSBuild 任务,该任务在构建运行之前执行(预构建操作)。

然后,该任务需要使用 TFS API 检查当前签入的所需文件,如果未找到,则必须将任务设置为失败。

这并不是很理想,因为它会向 Team Build 指示构建失败,这可能没有帮助,具体取决于您是否使用签入策略。也很难一目了然地找出哪些构建因任务而失败,哪些构建因真正的问题而失败。

您可以将构建更改为不那么频繁地发生,而不是每次签入,这将减少构建服务器上的负载。

否则,您可能想深入了解 Cruise Control .NET,它可能支持更好的条件构建。

I don't know of any OOTB feature which can do this, what you would need to do is write your own custom MSBuild task which is executed prior to the build running (pre-build action).

The task will then need to use the TFS API to check the current check in for the file you want and if it's not found you'll have to set the task to failed.

This isn't really ideal as it'll indicate to Team Build a build failure, which, depending on whether you're using check in policies, may be unhelpful. It'd also be harder to at-a-glance work out which builds failed because of the task and which failed because of a real problem.

You can change the build to occur less frequently rather than every check in, which will reduce load on your build server.

Otherwise you may want to dig into Cruise Control .NET, it may support better conditional builds.

愿与i 2024-08-10 12:53:24

如果您可以将 X.zip 移动到它自己的文件夹中,那么您可以使用仅查看包含 X.zip 的文件夹的工作区来设置 CI 构建。

然后,您需要添加对 tf get 的显式调用来下载其余代码,因为 Team Build 仅下载工作区正在查看的内容。

但这可能比自定义任务方法更简单?

If you could move X.zip into it's own folder, then you could set up a CI build with a workspace that only looked at the folder containing X.zip.

You would then need to add an explicit call to tf get to download the rest of the code as Team Build only downloads what the workspace is looking at.

But this might be simpler than the custom task approach?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文