是否可以防止构建链在 TeamCity 中被中断? [英] Is it possible to prevent a build chain from being interrupted in TeamCity?

查看:20
本文介绍了是否可以防止构建链在 TeamCity 中被中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 TeamCity 7.1.3 中有以下设置:

I have the following set-up in TeamCity 7.1.3:

项目 A

  • 构建与部署 A
  • 测试 A(快速)
  • 测试 A(慢)
  • 测试 A(非常慢)

项目 B

  • 构建与部署 B
  • 测试 B(快速)
  • 测试 B(慢)

A 的所有测试都依赖于 'Build &部署 A' 并且 B 的所有测试都依赖于'Bui​​ld &部署 B'.依赖都是快照依赖,设置如下:

All of the tests for A depend on 'Build & Deploy A' and all of the tests for B depend on 'Build & Deploy B'. The dependencies are all snapshot dependencies with the following settings:

  • 如果有合适的版本,请不要运行新版本
  • 只使用合适的成功构建
  • 在同一个代理上运行构建

所有测试都有 VCS 触发器.慢速测试仅在源代码管理中的特定文件夹发生更改时运行.当对项目 A 进行提交时,以下项目将添加到构建队列中:

All of the tests have VCS triggers. The slow tests only run when particular folders in source control are changed. When a commit is made to project A, the following projects are added to the build queue:

  • 构建与部署 A
  • 测试 A(快速)
  • 测试 A(慢)
  • 测试 A(非常慢)

预提交构建在构建队列中以更高的优先级运行.因此,如果 while 'Build &部署 A' 正在对项目 B 进行预提交检查,然后构建队列如下所示:

Pre-commit builds run with higher priority in the build queue. As such, if while 'Build & Deploy A' is running a pre-commit check is made to project B, the build queue then looks like:

  • 构建与部署 B
  • 测试 B(快速)
  • 测试 B(慢)
  • 测试 A(快速)
  • 测试 A(慢)
  • 测试 A(非常慢)

这种设置的问题在于,它意味着 A 的测试是在项目 B 部署之后运行的.这是一个问题,因为项目 B 的部署覆盖了项目 A 所需的一些文件.被个人构建覆盖的文件是部署文件,它们不在 checkout 文件夹中,这就是它们不回滚的原因.有没有办法强制测试的构建链不被中断?

The problem with this set-up is that it will mean that the tests for A are run after project B has been deployed. This is an issue as the deployment of project B overwrites some of the files required by project A. The files which are being overwritten by the personal build are deployed files which are not in the checkout folder which is why they are not rolled back. Is there any way to enforce that the build chain for the tests isn't interrupted?

如果我从依赖项中删除如果有合适的版本,则不运行新版本"设置,则每个测试都需要完整的构建和部署.较慢的测试不能依赖其他测试来建立线性链,因为有时会运行测试 A(非常慢)",但不会运行测试 A(慢)".

If I remove the 'Do not run new build if there is a suitable one' setting from the dependency, each of the tests will require a full build and deploy. The slower tests can't depend on other tests to make a linear chain as sometimes 'Test A (Very Slow)' is run, but 'Test A (Slow)' isn't.

不幸的是,目前无法拆分构建和部署来创建人工制品.

Unfortunately it isn't currently possible to split the build and deploy to create artefacts.

有什么方法可以有效地在 TeamCity 中进行设置?

Is there any way to efficiently set this up in TeamCity?

推荐答案

我通过将 'build &deploy' 构建配置将一个文本文件写入包含构建类型和构建号的部署文件夹.所有测试都将文本文件中的值与当前构建快照依赖项进行比较.如果它们的值不同,则重新触发构建(强制重新构建依赖项),然后取消当前构建.

I solved the problem by making both 'build & deploy' build configurations write a text file to the deployment folder containing the build type and build number. All tests compare the values in the text file to the current builds snapshot dependencies. If they values are different, re-trigger the build (forcing dependencies to be rebuilt) and then cancel the current build.

通过调用取消构建:

http://teamcity.jetbrains.com/guestAuth/ajax.html?comment=<CommentMessage>&submit=Stop&buildId=<BuildId>&kill

如何在依赖项设置为重新构建的情况下触发构建:

How to trigger build with dependencies set to rebuild:

有可能吗在通过 HTTP 触发时强制 TeamCity 构建重建依赖项?

这意味着当测试运行不同步时,将重新触发部署,然后测试将运行.

This means that when a test is running out of step, the deployment will be re-triggered and then the tests will run.

这篇关于是否可以防止构建链在 TeamCity 中被中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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