A follow-up to this:

I ran the failing msbuild command from the command line (in the workspace) and 
checked the errorlevel, it was 1.

I then replayed the declarative script with some extra code:

msbuild %WORKSPACE%\\MSVC\\<proj> /p:Configuration=config_2 /p:Platform="Win32" 
/flp:logfile=ZodiacOutput.log /verbosity:normal
if errorlevel 1 (
   echo Failure Reason Given is %errorlevel%
   exit /b %errorlevel%
)

The Jenkins output was then:

Failure Reason Given is 1
Post stage
[Pipeline] script
[Pipeline] {
<snip>
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

So I had to explicitly check the errorlevel to detect the failure. Does this 
mean there is this a bug in the declarative script plugin?

Best regards

David

From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of David Aldrich
Sent: 18 October 2017 10:45
To: jenkinsci-users@googlegroups.com
Subject: [** SUSPICIOUS EMAIL **] Declarative script: 'bat' command fails but 
job succeeds

Hi

I have a declarative script that runs a ‘bat’ step. That step builds some VS 
Studio projects on a Windows slave by calling msbuild:

            steps {
                bat '''
                    call "%VSMSBUILDCMD%"

                    msbuild %WORKSPACE%\\MSVC\\<proj> /p:Configuration=config_0 
/p:Platform="Win32" /flp:logfile=Output.log /verbosity:normal

                    msbuild %WORKSPACE%\\MSVC\\<proj> /p:Configuration=config_1 
/p:Platform="Win32" /flp:logfile=Output.log /verbosity:normal

                    msbuild %WORKSPACE%\\MSVC\\<proj> /p:Configuration=config_2 
/p:Platform="Win32" /flp:logfile=Output.log /verbosity:normal

'''
}

The second msbuild command is failing (due to missing header files) and reports 
‘Build Failed’, but the script step succeeds and the post stage executes the 
‘success’ code.

Any idea why the step is not failing please?

Best regards

David



Click 
here<https://www.mailcontrol.com/sr/Vzuf+HRUf8PGX2PQPOmvUu5zZAYN1MosnTW3zhZKWbhh!Dytlro2e7hn8lMwcsgKRrt8KGK6VIJzr!jqbv!p6A==>
 to report this email as spam.
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b1500615c71c4a48b48714a3a1aa3706%40EUX13SRV1.EU.NEC.COM<https://groups.google.com/d/msgid/jenkinsci-users/b1500615c71c4a48b48714a3a1aa3706%40EUX13SRV1.EU.NEC.COM?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c2e2bae1aa964ce09bff3f891cd4d508%40EUX13SRV1.EU.NEC.COM.
For more options, visit https://groups.google.com/d/optout.

Reply via email to