pipeline multi branch, how to continue if error occures

38 views
Skip to first unread message

Klaus Rudolph

unread,
Sep 12, 2016, 7:20:31 AM9/12/16
to jenkins...@googlegroups.com
Hi all,

if I use gtest in pipeline setup and have a unit test which fails the groovy script stops.

How can I tell the script that I want to continue so that I am able to see the results from xunit/gtest plugin?

From the gui without running Jenkinsfile there I had to write "set +e" in the dialog box, but I don't know how to write that in groovy.

Regards
Klaus


R. Tyler Croy

unread,
Sep 12, 2016, 10:10:57 PM9/12/16
to jenkins...@googlegroups.com
(replies inline)
If the issue is just a single `sh` command return a non-zero exit code, then
you can avoid that with:

sh './test-runner.sh || true'


- R. Tyler Croy

------------------------------------------------------
Code: <https://github.com/rtyler>
Chatter: <https://twitter.com/agentdero>

% gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------
signature.asc

Sverre Moe

unread,
Sep 13, 2016, 1:58:05 AM9/13/16
to Jenkins Users
Either get return code from the executing shell script or surround with try-catch

final def returnCode = sh returnStatus: true, script: ""
if (returnCode != 0) {

}

try {
    sh
""
} catch (e) {

}
Reply all
Reply to author
Forward
0 new messages