强制 TFS2010 工作流构建失败而不是部分成功

发布于 2024-11-14 19:06:44 字数 351 浏览 1 评论 0原文

我当前有一个自定义工作流活动来运行外部进程,在成功编译解决方案后,它会返回 ExitCode <>如果外部进程失败,则为 0。一旦我知道该过程失败,我想将构建状态设置为 FAIL (正如您在代码未编译时所看到的那样),因此我添加了一个 SetBuildProperties 活动,它将 Status 属性设置为BuildStatus.Failed 但这似乎只会导致在构建完成时给出部分成功的构建。

我尝试在自定义活动中将构建的编译状态设置为失败,这确实会导致构建失败,但我真的不想这样做,因为在解决方案编译时它会产生误导。

谁能告诉我如何强制构建失败? (最好不必将编译状态设置为失败!)

谢谢

I currently have a custom workflow activity to run an external process, after the solution has been compiled successfully, that returns an ExitCode <> 0 if the external process has failed. Once I know that the process has failed, I want to set the build status to FAIL (as you would see if code has not compiled) so I have added a SetBuildProperties activity which will set the Status property to BuildStatus.Failed but this only seems to result in giving a Partially Succeeded build when the build is finished.

I have tried setting the build's compilation status to failed inside my custom activity which does result in a Failed build, but I don't really want to have to do that as it is misleading when the solution has compiled.

Can anyone tell me how I can force a build to fail?? (preferably without having to set the compilation status to failed!)

Thanks

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

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

发布评论

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

评论(2

套路撩心 2024-11-21 19:06:44

这里发生的情况是,当构建完成时,工作流管理器会将构建状态覆盖为取决于构建过程状态组合的值。在您的情况下,CompilationStatus 为 Succeeded,但自定义活动失败(您将 BuildStatus 设置为 Failed),因此整体状态将为 PartiallySucceeded。

这里唯一的解决方法是将 CompilationStatus 设置为 Failed 或 Unknown,然后构建状态将为 Failed。

我还没有尝试将 CompilationStatus 设置为 Unknown。但如果可以的话,你可以稍后返回并将其更改为“通过”。只是区分真正失败的编译构建的一种方法。

我知道这不是一个很好的解决方法:(

更新:使用 SetBuildProperties 活动将构建状态设置为“失败”,即使编译成功,我也能够使构建失败。

What happened here is that when the build finishes, the workflow manager will overwrite the build status to a value that depends on the combination of statuses of the build process. In your case, the CompilationStatus is Succeeded, but there is a custom activity failure (you set the BuildStatus to Failed), so the overall status would be PartiallySucceeded.

The only workaround here is to set the CompilationStatus to either Failed or Unknown, then the build status will be Failed.

I haven't tried setting the CompilationStatus to Unknown though. But if it can be done, you can later go back and change it to Passed. Just a way to distinguish with the real failed compilation builds.

Not a great workaround, I know :(

UPDATE: Using SetBuildProperties activity to set the build status to Failed and I was able to fail the build even though the compilation succeeded.

浅浅 2024-11-21 19:06:44

在 TFS 2013 中,使用自定义构建模板,您只需将构建状态设置为“失败”,同时将 CompilationStatus 和 TestStatus 保留为正确的值。
不过,您必须在测试运行后执行此操作,否则它会更新回来。使用 SetBuildProperties 活动并设置“Status”属性。

In TFS 2013, using a customized build template you can just set the the build status to Failed while leaving the CompilationStatus and TestStatus to it's rightful values.
You have to do it after the test run though, otherwise it gets updated back. Use the SetBuildProperties activity and set the "Status" property.

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