I have the following problem: my project has a file make_all.batthat performs several builds as follows:
call make_first_component.bat
if %ERRORLEVEL% gtr 0 ( exit /b %ERRORLEVEL% )
call make_second_component.bat
if %ERRORLEVEL% gtr 0 ( exit /b %ERRORLEVEL% )
There echoare no extra lines in this script (other than commands ).
Now, when I call this script manually, by double-clicking or from the command line, and make_first_component.bat does something like exit /b 1, make_all.batshuts down as intended.
When I call the script from the jenkins job (code below), the make_all.batsecond component continues, even if the first component fails. If I then sign up to the slave with this behavior and manually run the batch file there, it shuts down if the first component fails.
So what does Jenkins do that violates the concept %ERRORLEVEL%?
PS: I tried to do setlocal enabledelayedexpansion, and then using !ERRORLEVEL!, but it is always 0.
Note. The jenkins job has a “Run Windows operating system” step that looks like this:
cd %WORKSPACE%\src\bat
echo Setting up Visual Studio environment
call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" amd64
echo Building Project
call make_all.bat
if %ERRORLEVEL% gtr 0 ( exit /b %ERRORLEVEL% )
(This is a complete step)
source
share