Build failure classification
This topic describes how to create rules that map Jenkins build log messages to build failure classifications. These rules are used to analyze build logs and automatically classify build failures.
Overview
Users with roles based on the DevOps admin role generally have the permissions needed to manage build failure classification rules.
Other users can create classification rules inside a pipeline run, when analyzing build failures. For details, see Create rules to classify build failures automatically.
Best practices for managing rules
It's most convenient to create rules in a pipeline run's Logs tab. You can open a build log and create a rule based on a specific message.
You can edit existing rules or remove rules that are not necessary in the Settings men as described in Create a build failure classification rule.
The goal is to reach a small number of rules that cover most of the log messages and build failure classifications that are relevant for your pipeline runs.
Create a build failure classification rule
-
Open the Settings menu , click Spaces, and select a workspace.
-
In the DevOps tab, select Log Classification Rules.
-
Click + Rule to add a rule.
-
Give the rule a meaningful name, such as
Null pointer
. -
Enter the pattern that identifies the log lines you want to map to a specific build failure classification.
Use
*
as a wildcard and use a\
before special characters.For example,
*NullPointerException*
-
Select a classification to assign to log lines that match the pattern.
For example,
Code issue
Tip: To add classification labels to the list of available labels, go to a pipeline run's Builds tab and click the Build Failure Classification button .
-
Click OK.
The rule is applied whenever a Jenkins build log for a failed build is received.
Log lines that match the pattern are labeled with the specified classification. If a line matches more than one rule, it is classified by the most recently updated rule.
The relevant builds are automatically labeled with the first classification mapped in their log.
Modifying a rule that is already in use
Change a rule that is in use
If you change a rule's classification, any log line already assigned by this rule is labeled with the new classification.
This affects log files from previous builds, but does not affect the classification of any existing builds. The change in the rule affects the classification of future builds only.
Delete a rule that is in use
If you delete a rule that has already assigned a classification to a build log line, the classification is removed from all log files, but remains on any builds to which it was assigned.
See also: