I have a script task in one of my jobs that calls a command which doesn't return a proper error code when it fails. It does, however, log a message in the logs indicating the failure. What I'd like to do is define some keywords (regular expressions) that bamboo searches for in the build logs and fails the build if any are found.
I've had a look, but can't seem to find any features like this in Bamboo. Is it possible?
If you are using Linux, maybe you could enhance your script task - redirect your output to a file, grep it, cat it and return a result.
Another option would be to create a wrapper command that will return a proper exit code.
Finally. you could write a simple Bamboo task that launches your command (it's really easy!). Tasks writing tutorial.
If you decide to write a task, look at StringMatchingInterceptor and its usages to see how to match a string against log lines.
Not out of the box. I've heard there are people with similar requirements and from what I recall they end writing up their own plugins. And in your situation (fail build when log message is encountered) I'd go the same way, by writing custom plugin.
I'd write postBuildAction plugin which would scan buildLogs for particular string after each job is completed - I'd base on http://confluence.atlassian.com/display/BAMBOO030/Tutorial+1+-+Getting+Started+with+a+Simple+Post+Build+Labeller .The "Simple Post Build Labeller" has similar functionality, it just labels the builds instead of failing them.
Not very easy solution, but doable if you have programming skills (and time).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the suggestions guys. I ended up tee'ing the output to a file and using the return code of grep to deteremine success/failure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.