Sean Cavanagh
Sean Cavanagh

Reputation: 4917

How can I get Hudson to continue a build after a windows command fails?

I've got a build script from a 3rd party tool. It does it's job properly, but throws a useless exception at the end which I need to ignore.

But Hudson doesn't ignore it. It stops my build when this script exits with an error code != 0. Which it does, even when the last line is 'exit 0'.

There is no option in the Hudson build configuration to specify how to treat failure of a particular build step.

Is there a hidden option to tell Hudson to soldier on? Where is the general reference for Hudson's config.xml?

Upvotes: 3

Views: 3607

Answers (4)

John Kenyon
John Kenyon

Reputation: 31

On Unix systems, one way around the problem is to run it in a sub shell of bash, with an "exit 0" as the final command. For example:

bash -c "false; exit 0"

This will run "false" but will have a return value of 0.

This is a little hacky but does work. I do not know if a similar solution exists for windows.

Upvotes: 3

sfs
sfs

Reputation: 21

Use the Join trigger Plugin work great for me. check the "Trigger even if some downstream projects are unstable" option

Upvotes: 2

Sean Cavanagh
Sean Cavanagh

Reputation: 4917

Seems that one has to wrap the offending script in it's own bat:

copy con wrapper.bat
>myErrorMakingScript.bat
>exit /b 0

and then fire wrapper.bat from Hudson.

Upvotes: 2

Michael Donohue
Michael Donohue

Reputation: 11876

One of Hudson's key properties is that everything can be configured via the web interface. So looking at the config.xml is not the right approach.

In Hudson, your windows command can be launched via a batch file. I suggest looking into making that batch file return a zero error code, regardless of what your third party tool does. The first line would invoke your tool, and the second line would be 'exit 0'

Upvotes: 2

Related Questions