In my Jenkins scripted pipeline, I have a build stage that has the following sh command:
def buildcmd = "./scriptname.sh"+ <paramters>
def status = sh returnStatus: true, script:"""cd /to/some/dir
eval ${buildcmd}
"""
if(status != 0)
{
error("Failure")
}
After execution, scriptname
exits with status 2 and status
variable also contains 2 and the job fails. But however the stage result is shown as SUCCESS
. I expected both the stage result and build result to be FAILURE
.
Can anybody please clarify this.