Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to turn log errors into build fails?


We have an issue where occasionally we are seeing errors in our build logs but the build does not fail.

I would like to get a trigger that when specific errors appear in the logs we we set the build to fail and thus our developers are prompted to investigate.

I was trying to use if statements in our batch files but can't come up with the right statement.

An example condition is if make-ERROR is present in the log then set the build to fail.



1 answer

0 votes

Guess that's obvious, but I'd strongly recommend to identify why the build is not failing in your scenario, usually the build tool in question just requires an additional flag to return an error code to Bamboo (for example, you can return a non zero exit code from script tasks to let the build fail).

That being said, there are certainly scenarios where it might not possible or at least inconvenient to fix the build in this regard, here are two possible solutions:

1. Provided you can redirect the build tool output to a file, you might be able to leverage Iulius Hutuleac's Generic Test Results Parser for Bamboo, which offers Simple file parsing and test case handling for generic test result formats:

Just select the files, create a regular expression matching lines that should be treated as failed test cases and lines that should be treated as passed test cases.

2. Solution 1 is based on the Bamboo Test Collection and Reporting SPI, which allows you to "write your own Tasks that parse files or logs that contain test results and have the results display in Bamboo":

TestCollationService supports parsing custom test formats defined by either a custom TestReportCollector (file based) or TestReportProvider(non-file based) implementation.

As outlined, the TestCollationService supports files and log parsing, but solution 1 only supports the former right now. However, the app is available as open source on Bitbucket, so you can grab it for inspiration and create a dedicated app four your scenario (mind the GPL license though), or better yet submit a pull request that adds log parsing so that the community can benefit from this notable improvement :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program 2

We’re preparing for Bamboo 8.0, which will be our first Data Center release. To make sure our app vendors and customers with written in-house apps are prepared, we’re launching Bamboo 8.0 Early Acces...

134 views 1 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you