Take special precautions about unexpected exceptions thrown inside the finally block. In that case script-security-plugin is not going to interpret approval requests correctly.
On Thu, May 5, 2016 at 9:47 PM, Mike Caspar <m...@caspar.com> wrote: > Awesome. > > This worked great. > > I managed to simply wrap a try around my whole file and then a > catch/finally for success and failure. > > Craig, I'll look at the example. Thanks > > I did figure out that I needed to use the error tag with some text during > my catch block and that properly set it the status to failed.. Cool. > > Where would be a good place to put this as an example in the docs for > others ? > > Craig, any suggestions where I might put a section for try/catch and > "simulating" what was there before for others who will no doubt find > themselves in similar transitions ? Any thoughts are a good place to start. > > Mike > > Oh.. thanks again to Craig Rodrigues and Baptiste Mathus > > > On 2016-05-05 3:38 PM, Craig Rodrigues wrote: > > Hi, > > Yes, in your pipeline script, you need to catch exceptions for what you > want to do. Be careful, if the build fails, you will need to set > currentBuild.status and re-throw the exception in order for the build to be > marked as failed. > > Look at this example which I wrote: > > https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/build-test.groovy > > -- > Craig > > On Thu, May 5, 2016 at 12:24 PM, Mike Caspar < <m...@caspar.com> > m...@caspar.com> wrote: > > >> try { >> step 1 >> step 2 >> step 3 >> step 4 >> step 4 >> } >> catch >> { >> task {send email of build status} >> } >> finally >> { >> task {send email of build status} >> } >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Jenkins Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jenkinsci-users/5sN7BR7daOs/unsubscribe. > To unsubscribe from this group and all its topics, 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/CAG%3DrPVfqa72x317P1OO9zZnyvmP73vPcQyoH7PsH7OVfaRTRmQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > https://groups.google.com/d/msgid/jenkinsci-users/CAG%3DrPVfqa72x317P1OO9zZnyvmP73vPcQyoH7PsH7OVfaRTRmQ%40mail.gmail.com > . > 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/a2bd3ac9-2a99-af64-bbee-3c403f0dfa13%40caspar.com > <https://groups.google.com/d/msgid/jenkinsci-users/a2bd3ac9-2a99-af64-bbee-3c403f0dfa13%40caspar.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Antonio Muñiz Software Engineer CloudBees, Inc. -- 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/CAJc7kzRsWdJoUqKwJA7SR2VbwSPj%3DJ-ii9GwWucBqV2LdjuytA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.