Problem:
Depending on my script in my Jenkins task, I sometime wants to quit the task
marked as successful in the middle of a code section. Is that possible?
I tried using exit code in script, but that doesn't exit Jenkins
.
Yes it is possible you could use exit 0
- success exit 1
- failed(or any other number)
Id depends on how much call levels you currently on. Try executing several exit commands like:
exit 0 exit 0 ...so on
Alternatively see Is there a way to write a bash function which aborts the whole execution, no matter how it is called? . There should be a way to kill process with a successiful return code.
One more reference: https://serverfault.com/questions/390846/kill-a-process-and-force-it-to-return-0-in-linux