繁体   English   中英

Groovy Postbuild如何检查先前的post-build操作的日志消息

[英]How can Groovy Postbuild check the log message of a previous post-build action

我想访问另一个后构建操作的日志,该日志在常规的后构建之前运行。

控制台输出如下所示:

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.48
Code Metrics Report path: **/*.Metrics.xml
Code Metrics Report Not Found.
Build step 'Record VS Code Metrics PowerTool Report' changed build result to UNSTABLE

我不能使用manager.logContains()因为输出是由另一个生成后操作生成的。

我可以将构建状态设置为SUCCESS,但是仅当构建后操作记录了Build step 'Record VS Code Metrics PowerTool Report' changed build result to UNSTABLE ,我才想这样做

if (manager.build.result == hudson.model.Result.UNSTABLE 
        && ???.contains("Build step 'Record VS Code Metrics PowerTool Report' changed build result to UNSTABLE") {
  manager.build.@result = hudson.model.Result.SUCCESS
}

您可以尝试使用manager.build.logFile.readLines()

例如,

if (manager.build.result == hudson.model.Result.UNSTABLE

        && manager.build.logFile.readLines().contains("Build step 'Record VS Code Metrics PowerTool Report' changed build result to UNSTABLE") {

    manager.build.@result = hudson.model.Result.SUCCESS

}

有关示例,请参见Oni Dar的出色答案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM