Build Failure Analyzer

Skip to end of metadata
Go to start of metadata

This plugin analyzes the causes of failed builds and presents the causes on the build page. It does this by using a knowledge base of build failure causes that is built up from scratch.
Saving statistics about failure causes is also possible.

Plugin Information

Plugin ID build-failure-analyzer Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
Dependencies
1.7.0
Apr 01, 2014
1.480
git (version:1.1.10)
gerrit-trigger (version:2.7.0, optional)
Source Code
Issue Tracking
Maintainer(s)
GitHub
Open Issues
Robert Sandell (id: rsandell)
Tomas Westling (id: t_westling)
Usage Installations 2013-Apr 656
2013-May 744
2013-Jun 806
2013-Jul 912
2013-Aug 961
2013-Sep 1023
2013-Oct 1124
2013-Nov 1160
2013-Dec 1174
2014-Jan 1253
2014-Feb 1313
2014-Mar 1381

Knowledge base

The plugin comes with an empty knowledge base of failure causes. Populating this knowledge base is done by using the link "Failure Cause Management".
The link is shown only if the permission UpdateCauses is set for the current user. Press "Create new" and add a name and a description for the Failure Cause.
The description should contain the reason why this build failed as well as possible solutions for the build failure.

One or more optional categories can be added as a whitespace-separated list. These categories are only used for the statistics part of the plugin.
Add one or more Indications by pressing "Add Indication". By default, only one type of Indication exists, a "Build Log Indication".
Plugin developers can add new Indication types and more are planned to be added to the plugin itself.
The Build Log Indication searches through the build log, one line at a time, for a regular expression.
It uses Pattern.match, so the regular expression needs to match the whole line, e.g. .*some words in the middle of a line.*

Adding new failure causes and indications to the knowledge base.

From version 1.3.1 of the plugin, regular expressions can be tested on the Failure Cause Management page, in two different ways:

  • Writing a text in the text field shown above and testing against that.
  • Writing a URL to a build log in the text field. The plugin then runs through the log trying to match the regexp.

When accessing the Failure Cause Management page from a build, the URL will be added to the text field automatically.

The plugin comes with two ways of saving the knowledge base:

  • Local knowledge base. Saves the knowledge base in memory and serializes it as an xml file on the local Jenkins server (i.e. the "standard" Jenkins way of saving information).
  • MongoDB knowledge base. Saves the knowledge base in a Mongo database. This can be used to share the
    same knowledge base between servers. The knowledge base is still cached locally in-memory to avoid unnecessary database accesses.
    Plugin developers can add new knowledge base types.

Build log scanning

All builds on the server that are non-successful (aborted, failed, unstable) will be scanned for all failure causes. 
If an indication is found, the description will be put directly on the build page, with a link to the matching line in the build log.
If no cause is found, a text stating this will be shown. The text is configurable on the main configuration page of the server.

The build page when the build failure analyzer has found a failure cause.


The build log with the matching line marked in red.

Statistics

If MongoDB or some knowledge base type that supports statistics is used, statistics will be saved to that database. The same information
that is shown on the build page is saved to the database.

Administrative settings

On the configure system page in Jenkins, under Build failure analyzer, some new settings are available:

  • Enabled - since the plugin scans all failed builds, we felt the need to be able to disable the scanning. Uncheck to disable.
  • Text when no failure causes are found - text to show for failed builds whose failure cause is not found in the knowledge base.
  • Storage type - Jenkins Local or Mongo DB, as described above. For Mongo DB, configuration details to fill in are as follows: Host, Port, Database name, Username and Password for the Database, Enable Statistics logging (described above).
  • Convert knowledge base - If this check box is checked when the configuration is saved and a change has been made to the knowledge base settings, the data from the old knowledge base will be added to the new one. Note that duplicates could appear this way, so make sure that you untick this check box if you for example just have changed the username or password, or if you want to start with a clean knowledgebase.
  • Send notifications to Gerrit-Trigger-plugin - if enabled, will send the text for the found failure cause via the gerrit-trigger-plugin to Gerrit.
  • Concurrent scans - To speed up the scanning, each build will get a threadpool of this number of threads, with each thread handling one indication. For a small system, 3 is usually enough.

Tips & Tricks

Aggregate statistics to Graphite

If you are using the MongoDB KnowledgeBase, you can use these scripts in a cron job to aggregate the statistics into Graphite.

Change Log

Version 1.7.0 (released Apr 1, 2014)

  • Multi line build log indications
  • Optionally store statistics about successful builds

Version 1.6.0 (released Mar 10, 2014)

  • Ability to re-scan non scanned builds (for new installations) and all builds for a project
  • Graphs on projects, slaves and master(s) if using a statistics logging enabled knowledge base (like the MongoDB Knowledge base)
  • Shows failure causes from downstream builds directly on the upstream build page.
  • ListView column showing the failure cause of the last build, if there is one.

Version 1.5.1 (released Nov 19, 2013)

  • Fixed an XSS vulnerability

Version 1.5.0 (released Apr 24, 2013)

New Features
  • The found failure cause is exposed to the REST Api (jobX/1/api).

Version 1.4.1 (released Mar 14, 2013)

Bugs fixed

Version 1.4.0 (released Feb 15, 2013)

New Features
  • Possibility to test regexps on a build log
Bugs fixed
  • Log annotation bugfixes.
  • JENKINS-15948 Build Failure Analyzer icons aren't displayed if Jenkins isn't installed at root context.(again)
  • JENKINS-15926 Build Failure Analyzer with Timestamper output ugly.(again)
  • JENKINS-16596 Repeat/double loggin issue due to Build failure Analyzer.
  • JENKINS-16104 Build Failure Analyzer: Ugly output from plugin.
  • NPE fix when a slave is taken offline during a build.
  • Fix for internal serialization of matrix aggregated indications.
  • Small UI fix in failure cause management page.

Version 1.3.0 (released Dec 06, 2012)

New Features
  • Possibility to test regexp on a line of text when editing BuildLogIndications
  • Output from Build Failure Analyzer shown in normal console.
Bugs fixed
  • JENKINS-15986 Cannot save job configuration pages on Jenkins 1.463 or newer.
  • JENKINS-15948 Build Failure Analyzer icons aren't displayed if Jenkins isn't installed at root context.
  • JENKINS-15926 Build Failure Analyzer with Timestamper output ugly.
Other
  • Updated Gerrit Trigger optional dependency: 2.7.0

Version 1.2.0 (released Nov 22, 2012)

Initial Release

Known issues

Breaks Job configuration pages on Jenkins 1.463 or newer
The problem we have seen is when loading configuration pages. We don't have a registered descriptor for our notifier,
hence, when the hetero-list for the post build actions is generated, an Exception is thrown.

Labels

plugin-post-build plugin-post-build Delete
plugin-report plugin-report Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 28, 2012

    jswager - says:

    Exactly how is the "Job configuration pages" broken?  I have been getting s...

    Exactly how is the "Job configuration pages" broken?  I have been getting some odd behavior on my config pages after installing - I can't typically save or apply until I hit a "delete" button down in an unlabelled section of the configuration.  Is there a JIRA incident open that I can watch for a fix?

    1. Nov 29, 2012

      David Resnick says:

      I opened JENKINS-15986 for the job configuration page problem.

      I opened JENKINS-15986 for the job configuration page problem.

  2. Nov 30, 2012

    KY Lee says:

    This plugin will probably be what I need to switch over from Cruise Control.NET ...

    This plugin will probably be what I need to switch over from Cruise Control.NET because I can easily use regex to search in the logs for any kind of information with xsl.

    However, can the output of this plugin be used in the email too? In Cruise Control.NET, what is present in the email is identical to the build result dashboard. Thanks.

    1. Feb 15, 2013

      Tomas Westling says:

      We could probably make a solution by integrating our plugin with the email-ext p...

      We could probably make a solution by integrating our plugin with the email-ext plugin, we will add it to our backlog :)

      1. May 21, 2013

        Vladimir Zak says:

        Hi, I do vote for this too because email messages are very popular and especialy...

        Hi, I do vote for this too because email messages are very popular and especialy for the known troubles could help the users to see the problem quickly.

        Thanks.

        zakyn

  3. Dec 27, 2012

    Alexander Artemov says:

    This is a very useful plugin, but now it has some seriuos bugs: When a problem...

    This is a very useful plugin, but now it has some seriuos bugs:

    1. When a problem is identified, the build log is duplicated - it becomes two times large, but the second part is the same log + junk text, for example:  [8mha:AAAAdB+LCAAAAAAAAABb85aBtbiIQSOjNKU4P0+vIKc0PTOvWK8kMze1uCQxtyC1SC8ExvbLL0llgABGJgZGLwaB3MycnMzi4My85FTXgvzkjIoiBimoScn5ecX5Oal6zhAaVS9DRQGQtr4jMKkbAI50d5WBAAAA [exec] 27.12.2012 14:12:51 liquibase.database.sql.CreateTableStatement getSqlStatement

    2. In many cases the highlighted line in the build log is not the right line, but the line after the correct one or 1-2 lines lower.

    3. When a problem is identified and I click on Indication link, it is just build log open, but not the place where the indication is found.

    All these problems seem to take place when the build log is not small. I have this problem with logs of 1.5 Mbytes and more.

    1. Feb 14, 2013

      Dave Abrahams says:

      I wonder if this is perhaps an interaction with mixed end-of-line styles in your...

      I wonder if this is perhaps an interaction with mixed end-of-line styles in your log?  If you find a few mixed EOLs, that would be a clue for the developer.

    2. Feb 15, 2013

      Tomas Westling says:

      These problems have all been taken care of in the 1.4.0 release.

      These problems have all been taken care of in the 1.4.0 release.

  4. Feb 14, 2013

    Dave Abrahams says:

    I'd love it if the failure explanation were visible other than by clicking a tin...

    I'd love it if the failure explanation were visible other than by clicking a tiny lightbulb icon.  At least hovering over the icon should pop it up.  But also, the explanation should appear in the job page.

    1. Feb 15, 2013

      Christopher Orr says:

      The explanation does already appear on the build page (rather than the project p...

      The explanation does already appear on the build page (rather than the project page).

  5. Feb 23, 2013

    Alistair Todd says:

    Updated to 1.4 but still don't get the icons. The link comes out as http:/...

    Updated to 1.4 but still don't get the icons.

    The link comes out as http://127.0.0.1:8080/jenkins//plugin/build-failure-analyzer/images/16x16/information.png

    It would work if it was:

    /jenkins/plugin/build-failure-analyzer/images/16x16/information.png

    Otherwise, this is a great plugin. Thanks.

    1. Feb 25, 2013

      Tomas Westling says:

      The double slashes in the beginning does no harm for us, not sure what is differ...

      The double slashes in the beginning does no harm for us, not sure what is different for you.

      Anyway, this should be a quite easy bug to fix, we just need to make sure we aren't adding double slashes anywhere.

  6. Jul 03, 2013

    Frank Merrow says:

    I just found this plugin and like it already despite the drawbacks discussed abo...

    I just found this plugin and like it already despite the drawbacks discussed above.  I do TONS of customer support on builds and this could help a lot.

    Feature requests:

    1. Would like to have the definitions in source control and shareable across multiple Jenkins instances.  I don't want to have 20 separate databases for 20 different Jenkins.  That is not to say you need to have some kind of "share mode" that allows updates on a file server, but honor the read-only bit and don't attempt/allow updates unless it is clear.  Also keep all the definitions in a single file or directory so they can be easily isolated and moved from Jenkins to Jenkins.  (Haven't looked yet how your are currently doing this yet).

    2. Would like to have "and" as well as "or" in the definitions . . . In my case, a Python Exception can come from several different sub-systems and after finding "Traceback" I would like to be able to explore the Traceback and assign blame based on source path.  So it would be nice if the "or" search could be limited to the "first line plus a few".

    I have done a "poor man's" version of exactly this using the "Log Parser Plugin", but this is much more expressive, allows more categories and (the big one for me) an explanation of what the user should do to fix the issue.

    This could save me a ton of customers calls . . . as time allows, I would be happy to help in expanding this plugin with code or docs if you are interested.

    Frank

    1. Sep 09, 2013

      Tomas Westling says:

      Sorry for the late reply. Glad that you like the plugin :) 1. We currently have...

      Sorry for the late reply. Glad that you like the plugin :)

      1. We currently have 2 ways of saving the failure causes; either locally where you get the issue you express, or using MongoDB.

      If you use MongoDB you can point all of your 20 Jenkins instances to the same database.

      You could also implement a new way of saving failure causes and do a pull request :)

      2. This is a commonly requested feature and something we would like to do. The feature was discussed internally before the first version of the plugin was created.

      We haven't had time yet to look at a solution for this but would gladly accept contributions.

      Br Tomas

  7. Oct 24

    Martin Spamer says:

    Regarding the icon bug om Build History, I think the problem is in PluginImpl at...

    Regarding the icon bug om Build History, I think the problem is in PluginImpl at line 256.

     return Hudson.getInstance().getRootUrl() + contextPath + getImageUrl(size, name);
    

    Entering the following code into the Jenkins Script console

     Hudson.getInstance().getRootUrl()
    

    Shows that the context path is already appended to Hudson.getInstance().getRootUrl()

  8. Nov 08

    Kean Stump says:

    Is there any way to force a rescan of all failed builds? The doc reads like the ...

    Is there any way to force a rescan of all failed builds? The doc reads like the log is scanned only when the build fails. 

    Kean

  9. Dec 17

    Adam Guja says:

    sorry, I thought I had a solution for this, but it does not work yet

    sorry, I thought I had a solution for this, but it does not work yet