gpt4 book ai didi

groovy - Groovy Postbuild 如何检查先前构建后操作的日志消息

转载 作者:行者123 更新时间:2023-12-01 22:56:41 25 4
gpt4 key购买 nike

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

控制台输出如下所示:

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(),因为输出是由另一个构建后操作生成的。

我可以将构建状态设置为成功,但我只想在记录构建后操作时才执行此操作构建步骤“记录 VS Code Metrics PowerTool 报告”将构建结果更改为不稳定

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's excellent answer举个例子。

关于groovy - Groovy Postbuild 如何检查先前构建后操作的日志消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33670371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com