Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to categorize build failures with jenkins?

I am looking for a solution that would allow us to categorize build failures like:

  • developer (a developer added bad code)
  • build system (error in the build system)
  • infrastructure problem (servers not responding)

It would be great if this could be done automatically most of the time, based on the console output but also we need an option to make a build to be of certain status.

How can we obtain this behaviour from jenkins?

like image 308
sorin Avatar asked May 16 '12 13:05

sorin


People also ask

How does Jenkins know when a build fails?

The Build Failure Analyzer Jenkins 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 maintained from scratch.

How do you categorize jobs in Jenkins?

To create the view, just follow the usual procedure to add new views and you will find a new type of view named "Categorized Jobs View". The configuration page has a new section, "Job group categorization". You can add as many expressions as you want.

How do I fix broken build in Jenkins?

The user needs to open the console output for the build and will try to see if any file changes that were missed during building the project. If there aren't any problems on it then a much better approach would be clean and update his local workspace to copy the problem on their local machine and will try to solve it.


1 Answers

The Build Failure Analyzer plugin lets you set regular expressions for categorizing current and future builds. Once the regular expressions have been set, detection is automatic for current and future builds. This may be exactly what you're after.

I have also implemented a lightweight, manual failure categorization plug-in for Jenkins, which provides a simple drop-down and additional text field for categorizing failures by hand. This was done for a research project studying build failures. Categorizations are currently saved as separate XMLs in each build's directory, to have no impact on Jenkins' own files. Categories are displayed in build listings and in a separate categorization page for each build.

Lightweight Jenkins plugin for manual failure categorization

I regret to say that the plugin is not currently shared anywhere, as it contains some hard-codings for a specific project. If there is demand for such a plug-in, I can re-visit the code and publish it open source. However, for your purposes it seems like the automatic solution of Build Failure Analyzer would be more suitable.

The plug-in is very simple and similar things are not hard to implement. If you wish to make something similar yourself, or perhaps extend the automated Build Failure Analyzer plug-in to fit your needs, the Jenkins plugin tutorial and Extend Jenkins pages are a good starting point for Jenkins plug-in development. For persistence, getting familiar with XStream would be beneficial, as that is what Jenkins and most plug-ins internally use to serialize data to XML.

like image 94
Ilnore Avatar answered Sep 25 '22 06:09

Ilnore