Hi,
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.
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 customTestReportCollector
(file based) orTestReportProvider
(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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.