【发布时间】:2017-09-17 02:58:27
【问题描述】:
嗨,即使我的 ant 构建失败,TFS 也会显示该步骤成功并继续进行。我尝试过使用 failonerror,但似乎很少有任务可以使用 failonerror。是否有解决方法,以便在 ANT 构建失败时 TFS 实际上失败。
【问题讨论】:
标签: tfs ant build failonerror
嗨,即使我的 ant 构建失败,TFS 也会显示该步骤成功并继续进行。我尝试过使用 failonerror,但似乎很少有任务可以使用 failonerror。是否有解决方法,以便在 ANT 构建失败时 TFS 实际上失败。
【问题讨论】:
标签: tfs ant build failonerror
您可以使用 logging commands 从您的 powershell 脚本返回警告和错误。先捕获ant build log,判断ant build是否失败。然后在 powershell 构建任务中使用task.logissue type=error,您可能会使构建任务失败,然后构建失败。
更多细节你可以看看这个类似的问题:Is it possible to raise and display build warnings from build steps using TFS 2015
【讨论】:
Write-Host "##vso[task.logissue type=error;]Test error" 之类的 powershell 脚本中编写此代码,然后 powershell 任务将失败,整个构建将失败。更多详情请参考上述链接中mattbrooks2010的评论:github.com/Microsoft/vsts-tasks/issues/573