I am having trouble with a Jenkins pipeline that is not failing when a called batch file fails. I have checked the batch file, it returns a non-zero status code, but somehow this seems to be not considered. Does anyone of you have a hint for me?
desired pipeline
node {
stage('1'){
dir('_src') {
bat 'call test.bat'
}
}
}
Calling the batch in cmd window results in the following
>call test.bat
INFO: Started ...
ERROR
Press any key to continue . . .
>echo %ERRORLEVEL%
2
I also used the following pipeline for testing
node {
stage('1'){
dir('_src') {
bat '''call test.bat
echo %ERRORLEVEL%'''
}
}
}
... with this output
C:\_src>call test.bat
INFO: Started ...
ERROR
Press any key to continue . . .
2
Still, the pipeline is not failing. Any ideas?