0

I recently began work on continuous integration systems and started to learn how to use Buildbot.

I have a buildslave that runs on every commit, and I wanted to add a new step to parse certain data files after the build has completed and based on the results trigger a build pass/fail.

buildSteps.addStep(shell.ShellCommand( description=["File Parser"], workdir=dataDirectory, command=["call", "ant", "ParseTest"] ) )

At the end of the step, the output resembles this:

    [java] Java Result: 1

    BUILD SUCCESSFUL
    Total time: 38 seconds
    program finished with exit code 0

In the java code I am using System.exit(1) to represent a failure and System.exit(0) to represent success.

So my question is, How can I change the actual exit code to a non-zero value so Buildbot recognizes it as a failed build?

1 Answers1

0

I don't know buildbot but the failonerror attribute from ant java task is default set to false.
So to get a BUILD FAILED if java exits with a returncode other than 0 you have to set the
failonerror attribute from java task to true.

Rebse
  • 10,307
  • 2
  • 38
  • 66
  • Thanks! I had actually just found the answer I was looking for here: http://stackoverflow.com/questions/907364/how-can-i-have-my-ant-task-pass-or-fail-based-on-the-results-of-a-jar-it-runs Example: Setting failonerror="true" worked. :D – Corey Ringer Oct 25 '12 at 20:35
  • you always to check the default setting for the failonerror attribute for the tasks you're using in ant manual as there is a lack of regularity. Some tasks, f.e. java + exec have default failonerror=false (but exec has failifexecutionfails = true !?), whereas copy + javac have default failonerror=true – Rebse Oct 26 '12 at 21:28