My build and deploy step creates some logs. I would like to search the logs for and fail the build if I see certain strings.
A good log looks like
log stuff
step 1: SUCCESS
step 2: SUCCESS
A log with failures would look like
log stuff
step 1: SUCCESS
step 2: FAIL
My check is
grep FAIL /path/to/build.log
if [ $? -eq 0 ]; then
exit 1
fi
I've also tried
RESULT=`grep FAIL /path/to/build.log`
if [ -n "$RESULT" ]; then
exit 1
fi
and various ways of piping in the file.
Hudson is failing the build on grep not returning anything. So is there a better way to search for the string? Is there a way to have grep not returning anything not exit the script right there?
Version Stuff: * Hudson 1.355