【发布时间】:2019-02-09 12:27:31
【问题描述】:
我有一个 TeamCity 构建,其中一个步骤是调用 .proj 文件的 MSBuild:
Runner type: MSBuild
Build file path: TestProject.proj
Targets: Test
在 .proj 我有目标:
<Target Name="DeployTestService">
<Message Text="Deploying test service" />
<Exec Command="powershell -Command "& { myUsefulPsScript.ps }"" />
</Target>
<Target Name="Test">
// other stuff, then
<CallTarget Targets="DeployTestService" />
</Target>
它在大多数情况下都很好用。然而,如果 powershell 脚本失败(抛出未处理的异常,我可以在完整日志中看到它的文本)并以非零代码退出,我会在 Teamcity 构建结果中看到以下内容:
Tests passed: (some number); exit code 1
构建树只是说:
Build failure condition (1)
Process exited with code 1
[Time]Process exited with code 1
在我获得完整的日志之前,我真的不知道哪一步失败了以及究竟是如何失败的。这不是要解决最初的问题,而是要更快地找到错误的步骤。
有没有办法让 Teamcity 说出类似“步骤 N 中的跑步者失败并出现此错误消息 [我在完整日志中看到的消息]”之类的内容?
【问题讨论】:
标签: powershell error-handling build continuous-integration teamcity