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
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
Click here 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-use...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/b1500615c71c4a48b48714a3a1aa3706%40EUX13SRV1.EU.NEC.COM.
For more options, visit https://groups.google.com/d/optout.
Here’s a better view of my script:
pipeline {
agent none
options { buildDiscarder(logRotator(numToKeepStr: '20')) }
triggers {
pollSCM('H/5 * * * *')
}
stages {
stage('build_gcc') {
<snip - this stage runs on a Linux node>
}
stage('build_VisualStudio') {
agent { label "jenkinswin10" }
environment {
VSMSBUILDCMD = 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsMSBuildCmd.bat'
}
steps {
bat '''
call "%VSMSBUILDCMD%"
msbuild %WORKSPACE%\\MSVC\\myproj.sln /p:Configuration=Release /p:Platform="Win32" /flp:logfile=ZodiacOutput.log /verbosity:normal
'''
}
post {
<snip>
}
}
}
}
stage('Build') {
steps {
script {
Yes, that’s right. Sorry for using wrong term.
bat returnStatus: false, script: "\"${bcad.msbuild_current}\" ${bcad.msbuild_solution_name} ${bcad.msbuild_default_arg} /t:Build"
step([$class: 'WarningsPublisher', canRunOnFailed: true, consoleParsers: [[parserName: 'MSBuild']]])
Thanks for your answer.
--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0e30d94d-ccfc-4b72-b8a8-a7280ee99ce5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.