Windows batch w/ error ends unexpectedly w/ status 'Success'

Hello

I created a simple job in Jenkins executing a short sequence of basic batch commands in Windows intentionally with an error to induce a failed build. The log registered the error (as expected) but finished with status: ‘Success’ (not as expected!).

Shouldn’t this job end with status: ‘Failed’?

A similar job with an intentional error ends on Debian as ‘Failed’ in Jenkins (as expected). That’s why I expected the job on Windows to fail alike.

Console output of executed job:

You didn’t provide the “simple job” in which the error is.
It’s most likely that you are running multiple commands and ignoring the failures, and then return successfully from the cmd at the end of your script - which obviously counts as a success.

Thank you for your reply @JanneK.

The script consists only of echo and sleep commands.
The error is invoked in the line with ‘xxxx’ which is obviously not a valid command.

Here’s the script:

You are right @JanneK, the script doesn’t abort after encountering the unrecognized ‘xxxx’ line but is going on until the end of the script and returns with status ‘Success’. On Linux an unrecognized command aborts the script. That’s the difference.

Thanks!

1 Like