簡體   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