How to build failed in hudson using command command

Im using Hudson for our HTML assembly, the main reason for using CI is to check the html files during each file using the cse validator. To check the HTML I used the following code

@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
)

    set ERRORLEVEL=%HTMLVAL_ERROR%

POPD

The verification process works fine, but even in the HTML file there is an error. hudson does not start the build as unsuccessful, it will always succeed.

Please let me know how I can cause a build to fail from the command line.

+3
source share
1 answer

You should use the 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 entire batch.

0
source

Source: https://habr.com/ru/post/1792453/


All Articles