How can I customize the output of Jenkins? - jenkins

My Jenkins builds our code, via a batch script build step. The output/error streams are captured and displayed in the build page. Can I do something to highlight the errors? For example, I would like to colour in red all the lines that contain the string error SOME_CODE, and in yellow all the warnings.
Can this be done?

The Log Parser Plugin can do this:
The log-parser plugin allows to parse the flat console log generated
by the Hudson build. It does this by :
highlighting lines of interest in the log (errors, warnings,
information)
dividing the log into sections
displaying a summary of number of errors , warnings and information
lines within the log and its sections.
linking the summary of errors and warnings into the context of the
full log, making it easy to find a line of interest in the log
showing a summary of errors and warnings on the build page

Related

JMeter + Jenkins - How to view Response Data/Assert Failed Results using Performance Plugin in Jenkins

I am integrating JMeter to Jenkins and displaying the result/report using the Performance Plugin and so far it is working fine when the the report shows the Info about if the request is successful or failed, how much time does it take, percentage of error...
I would like to display here more Info if the request is failed, such as Response Data, or in case if it is failed because of an assertion, it should display the message here. Saying in other words, these approaches should act same as View Results Tree Listener in JMeter GUI but I do not know how to attach it to the Performance Plugin in Jenkins.
Does anyone have an idea how to achieve it? Thank you in advanced!
What you can do it add to your plan a View Results Tree and:
fill in file name property.
Click on Configure and check everything except CSV Column Names
Set Errors only
This way, when an error occurs, you'll have all details in this XML file which you can load in JMeter after test to analyze errors.

Add detailed failed tests information to email sent from jenkins

I had successfully configured jenkins build jobs send emails out with basic information in. The content is defined as:
Check console output at $BUILD_URL to view the results.
${FAILED_TESTS}
However, the ${FAILED_TESTS} only return the top-level information, e.g.
1 tests failed. FAILED: XXXMainTest.test Error Message: expected: but was: Stack Trace: java.lang.AssertionError: expected: but was: at test.XXXXTest.test(MainTest.java:27)
If I want to see detailed information thrown from the failed test, I need to click the link and click through each test suite until seeing the test failure information at every end.
Do you have any advice to add detailed tests information to email? Thanks.
I think you will find some help with this plugin:
EMail-ext Plugin
New to version 2.15 is the ability to add attachments using the Ant pattern matching syntax used in many places in Jenkins. You can set a maximum total attachment size in the global configuration page, or it will be unlimited.

Identifying failures in Jenkins Console Output

We run CI tests via Jenkins and review the results via Jenkin's Console Output. If one of the tests doesn't pass, it is printed to the Console in red. Nevertheless, the output is very long and it is tedious to search the entire log to find instances of red output. Are there any good solutions to the issue?
For instance, Gerrit's user interface displays file diffs and a user can use keyboard shortcuts n or p to jump to the next/previous diff block. Is there any such solution/plugin... for Jenkins?
There's the Collapsing Console Sections Plugin:
This plugin allows the creation of sections in build consoles.These sections can be individually collapsed to hide unimportant details. A floating outline widget is available to navigate through all the sections of a build.
and the Console Parser Plugin:
The console parser plugin parses the console log generated by the Jenkins build allowing for:
...
highlighting of errors, warnings , and info
...
separating the comparison log by sections
collapsible sections for faster viewing
You should use a reporting plugin in Jenkins corresponding to the test framework you have used in your project. e.g. If you are using TestNG , then Jenkins has a publish TestNG reports plugin for filtering out test results.
Similarly for Cucumber - there is pretty cucumber reports plugin.

How can I get the SVN log entry in Jenkins when sending email

I'm trying to create an automated build at work using Jenkins. We're using SVN for version control. When a build is successful I would like to send an email to my team saying... Person X has committed the following changes.
How can I include the committers name and the last SVN log entry in the body of the email?
I'm using the Jenking email-ext plugin.
Thanks!
Subject line:
To display the committer(s) of the last build, you can put the following into the subject line anywhere you want. Do note that if multiple people have committed since the last build, multiple names will be shown, hence the (space) in "%a ".
${CHANGES, format="%a "}has/have committed the following changes
Or to display a list of culprits that broke the build
Build broken by ${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="%a "}
Unfortunately, if a culprit's name appears several times in commit messages, it will appear several times in the subject too.
SVN log in the email
To get the SVN log into the email, I use the following:
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="<b>Changes for Build #%n</b><br>%c<br>", changesFormat="<br>[<a href='${JENKINS_URL}/user/%a/builds'>%a</a>] - (%r) %p<br> %m<br>"}
This was all pulled together from the Content Token Reference on-page help with lots of trial and error. Scroll to the bottom of your email-ext configuration, and click the ? icon in-line with Content Token Reference text (it may take a while to load)
Produces output similar to:
Changes for Build #123
[commiter_name] - (1234567) /svn/path/to/changed.files
Commit message here

Is it possible to configure CruiseControl.net to display task exit codes in results?

My company is developing a web application that builds in ant. I've been tasked with getting CruiseControl.net to differentiate between a build failure and a unit test failure, which it can't do natively. ( It currently lumps both together but doesn't help developers understand what's broken )
I have CC.net call a script that returns specific exit codes depending on the nature of an ant task failure. I'd like these exit codes to be reflected in the CC.net failure report / dashboard but am having some trouble finding resources on how this might be done.
Any suggestions?
Not directly. All the reports and display works from information in the logs which are XML files. The display and reports work by applying XSLT to these XML files.
Take a look at your build logs and unit test logs, to see if each of those process write the failure information to their respective log files.
If they do, you should be able to write a custom XSLT or modify the existing XSLT to display that information.
Edit:
A different approach based on your comment. You could probably redirect the ANT error code to a file. Then you could have a seperate ccnet task that takes the error code from that file and re-format and display it (depending on how/where you want it displayed)

Resources