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

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

问题描述

我在TeamCity 7.1.3中有以下设置:



项目A




  • 构建&部署A

  • 测试A(快速)

  • 测试A(慢)




专案B




  • 构建&部署B

  • 测试B(快速)

  • 测试B(慢)



A的所有测试依赖于'Bui​​ld&部署A,所有的B测试依赖于构建&部署B。依赖关系都是具有以下设置的快照依赖关系:




  • 如果存在合适的项目,不要运行新构建
  • $ b


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




  • 构建&部署A

  • 测试A(快速)

  • 测试A(慢)




预构建在构建队列中以更高的优先级运行。因此,如果当构建&部署A正在对项目B执行预提交检查,则构建队列看起来像:




  • 构建&部署B

  • 测试B(快速)

  • 测试B(慢)


  • 测试A(慢)

  • 测试A(很慢)


b $ b

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



如果从依赖关系中删除不运行新构建(如果有合适的一个)设置,则每个测试都需要完全构建和部署。较慢的测试不能依赖于其他测试来创建线性链,因为有时运行测试A(非常慢),但是测试A(慢)不是。



不幸的是,目前无法拆分构建和部署以创建工件。



有没有办法在TeamCity中有效地设置此功能?

解决方案

p>我解决了这个问题,使'build& deploy构建配置将文本文件写入包含构建类型和构建号的部署文件夹。所有测试将文本文件中的值与当前构建快照依赖项相比较。如果值不同,请重新触发构建(强制重新生成依赖关系),然后取消当前构建。



通过调用取消构建:

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

如何触发带有依赖关系的构建设置为rebuild:



是否可以强制TeamCity构建在通过HTTP触发时重建依赖关系?



这意味着当测试正在运行的步骤,将重新触发部署,然后运行测试。


I have the following set-up in TeamCity 7.1.3:

Project A

  • Build & Deploy A
  • Test A (Quick)
  • Test A (Slow)
  • Test A (Very Slow)

Project B

  • Build & Deploy B
  • Test B (Quick)
  • Test B (Slow)

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:

  • Do not run new build if there is a suitable one
  • Only use successful builds from suitable ones
  • Run build on the same agent

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:

  • Build & Deploy A
  • Test A (Quick)
  • Test A (Slow)
  • Test A (Very Slow)

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:

  • Build & Deploy B
  • Test B (Quick)
  • Test B (Slow)
  • Test A (Quick)
  • Test A (Slow)
  • Test A (Very Slow)

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?

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.

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

解决方案

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.

Cancel build by calling:

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

How to trigger build with dependencies set to rebuild:

Is it possible to force a TeamCity build to rebuild dependencies when triggered over HTTP?

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天全站免登陆