build failures: set build.code to exit code

and add it to the log footer.
Also stop using bash commands to echo success or failure.