My project is a free-form project with several windows batch command steps followed by a conditional build step which copies a .zip file to a network drive. The conditional build step checks the current status of the build and, if successful, performs the copy (essentially conditional artifact deploy as a build step). The conditional step is set to FAIL the build if the conditional step fails (and it does fail).
The best I can deduce from looking through the run-condition and jenkins code (for the first time) is that the result of the build is returning null, but I couldn't determine the cause.
I whittled down my build to a very simple test case. No source control, all options unchecked. Step 1 is a windows batch call to "echo hello > _hello.txt" followed by a conditional step. The conditional step checks for a Successful build status, and then copies "echo world > world.txt". This code is never reached because the null pointer exception is thrown.
The exception is also thrown if the only step in the project is the conditional check.
I assume that the freestyle project returns by default a NULL for the status of the build, and that a successful windows batch file step also does not set the build status to a non-NULL value. setting "exit 1" in the batch file stops the build, so clearly the status is being set on failure and not on success. I tried returning "exit 0" from the batch command but still observed the NullPointerException
Attached is the exception stack trace (also pasted below) and the config.xml file for the project.
Jan 13, 2012 5:39:30 PM org.jenkins_ci.plugins.run_condition.BuildStepRunner logEvaluateException
WARNING: Exception caught evaluating condition: [java.lang.NullPointerException: null], action = [Fail the build]
Jan 13, 2012 5:39:30 PM hudson.model.Run run
INFO: FOSS_SL #67 main build action completed: FAILURE