Passing or failing a build depending on a string in a log

Hi,

I have to run unit tests using a function that will print all the test results to a telnet log. I need to be able to search through this telnet log, and depending on whether I see a SUCCESS or FAILED string in this log, I need to be able to make Bamboo pass or fail the build. I am currently using Linux script to achieve this. Is there some kind of parameter that I can pass through the script that will pass/fail the build?

I have also been reading the documentation where it says that you can read logs.

From documentation:

We've added infrastructure for analysing build logs on the fly. For documentation, see LogInterceptor.  You can add these interceptors to the LogInterceptorStack in the BuildLogger. For examples of usage, see com.atlassian.bamboo.build.logger.interceptors.StringMatchingInterceptor and com.atlassian.bamboo.plugins.ant.task.AntBuildTask .

If I get my telnet log to print into the build log, would I be able to use this functionality? If yes, how would you do so?

Thanks

 

1 answer

If you already have a Linux script that analyzes the log, all you need to do is set the exitcode of the script to indicate to Bamboo if it's a success or fail.

If the script returns 0 (zero), the build continues with any further steps.
If the script returns anything non-zero, the build stops and fails. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,814 views 0 6
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you