3

每次提交后,我们都会在 jenkins 上运行 findbug 作业,其结果由静态分析插件发布。这通常完全按预期工作,但是有时(大约每 100 个构建一次)findbugs 以退出代码 137 退出。当它这样做时,也会生成一个完全空的 findbugs.xml 文件

空的 xml 文件导致静态分析插件认为这个构建非常棒(没有错误)并将其用作新的参考构建,这反过来又使之后的每个构建都失败/不稳定。

关于此退出代码的含义或如何防止它,我真的找不到任何有用的信息。我正在寻找一种方法来防止出现此退出代码 137 或让静态分析插件将此构建视为失败(而不是新的参考构建)

我也想知道这段代码的实际含义。

退出代码为 137 的作业的控制台输出(作业:#1957,未报告错误)

--- snip -- more applying of bugpatterns--
[findbugs] Applying edu.umd.cs.findbugs.detect.MultithreadedInstanceAccess to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.BadUseOfReturnValue to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.MethodReturnCheck to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.IDivResultCastToDouble to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.FindBadCast2 to nl/base/rela/entities/relagroups/RelationGroup$1
 [findbugs] Java Result: 137
 [findbugs] Output saved to findbugs.xml

BUILD SUCCESSFUL
Total time: 9 minutes 0 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Skipping file  of module /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml because it's empty.
[FINDBUGS] Computing warning deltas based on reference build #1956
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1956
Archiving artifacts

上一个作业的控制台输出(作业:#1956,报告存在的错误):

     ---snip---
 [findbugs] Applying edu.umd.cs.findbugs.detect.AtomicityProblem to nl/base/rela/entities/Project$1
 [findbugs] Applying edu.umd.cs.findbugs.detect.DefaultEncodingDetector to nl/base/rela/entities/Project$1
 [findbugs]       32 usecs/byte      29 msec     898 bytes  1 pass nl/base/rela/entities/Project$1
 [findbugs] Analysis completed
 [findbugs] Warnings generated: 770
 [findbugs] Calculating exit code...
 [findbugs] Setting 'bugs found' flag (1)
 [findbugs] Exit code set to: 1
 [findbugs] Java Result: 1
 [findbugs] Output saved to findbugs.xml

BUILD SUCCESSFUL
Total time: 9 minutes 30 seconds
[FINDBUGS] Collecting findbugs analysis files...
[FINDBUGS] Finding all files that match the pattern trunk/findbugs.xml
[FINDBUGS] Parsing 1 files in /data/hudson/workspace/crm-findbugs
[FINDBUGS] Successfully parsed file /data/hudson/workspace/crm-findbugs/trunk/findbugs.xml of module  with 770 warnings.
[FINDBUGS] Computing warning deltas based on reference build #1955
[ANALYSIS-COLLECTOR] Computing warning deltas based on reference build #1955
Archiving artifacts
4

1 回答 1

2
  1. 作为解决方法,添加运行脚本的 buld 步骤,该脚本检查 findbugs.xml 文件是否为空,如果是,则返回非零退出代码,使构建失败

  2. 在https://issues.jenkins-ci.org提交关于 Jenkins 插件的错误报告

  3. 可选:检查插件,自行修复,提交补丁

于 2013-03-30T05:24:09.397 回答