开发者

how to make a build failed in hudson using batch command

Im using Hudson for our HTML build main reason for using CI is to validate the html files during each files with cse validator. For validating the HTML I have used the following code

@echo off

PUSHD "F:\Solutions\Documents\Design\html\ValTest"
For %%X in (*.html) do (
"C:\Progra开发者_开发技巧m Files\HTMLValidator100\cmdlineprocessor"  -outputfile output.txt   -r1 %%X
set HTMLVAL_ERROR=%ERRORLEVEL%
type output.txt >> result.txt
)

    set ERRORLEVEL=%HTMLVAL_ERROR%

POPD

Validation process is working fine but even there is an error in the HTML file hudson is not triggering the build as failed, its always Success.

Please let me know how can I trigger the build failure from batch command.


You should use exit command :

@echo off

PUSHD "F:\Solutions\Documents\Design\html\ValTest" For %%X in (*.html) do ( "C:\Program Files\HTMLValidator100\cmdlineprocessor" -outputfile output.txt -r1 %%X set HTMLVAL_ERROR=%ERRORLEVEL% type output.txt >> result.txt )

POPD

exit %HTMLVAL_ERROR%

which sets the error level of the whole batch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜