Regarding 1 and 2: I think you should model them based on whether they are dependent on each other: * Either the two test sets are independently of each other, meaning that even if "Test Set 1" fails then that does not affect in any way the stability/outcome of the "Test Set 2" -> If so, run them in parallel, there is no reason to wait with starting "Test Set 2" until "Test Set 1" has completed. * Or "Test Set 2" builds upon functionality tested by "Test Set 1" -> If so, if does not make sense to run "Test Set 2" if "Test Set 1" fails, so dont try-catch any build failure but let Jenkins handle them automatically.
A more general way of looking at this: * Something that is modeled "serial" means that steps further down the pipe are depending on steps further up the pipe working fine. * Something that is modeled "in parallel" means that all branches can and should run independently of each other, and the outcome be joined once all branches have completed. Hope that helps! stefan. On Mon, Jan 22, 2018 at 11:18 AM, Joachim Nilsson < joachim.nils...@miljodata.se> wrote: > Regarding 3: The script language is Groovy so the expansion of > ${variablename} is only done when using a Groovy-String, which is defined > by double quotation marks ”, not single ’. > > So: change it to > > echo ”Caught-1 : ${exc}” > > > > /Joachim > > > > *Från:* jenkinsci-users@googlegroups.com [mailto:jenkinsci-users@ > googlegroups.com] *För *NickA > *Skickat:* den 18 december 2017 11:13 > *Till:* Jenkins Users <jenkinsci-users@googlegroups.com> > *Ämne:* Fail 1 stage in jenkinsscript > > > > Hi all, > > I have a debug script to experiment with Jenkins Scripting > I have three problems: > > 1. It's sequential, so first it should configure the machine and install > the product, then the first test set starts and if that is finished, the > second one starts. > They all run on 1 machine so I don't think parallel for testset 1 and 2 is > needed? > But the first issue I had, was that if tests failed in stage 2, then the > third one didn't start. Tried all kinds of things from the forums but > nothing helped. > > 2. I added try/catch and that works; the status at the end is failed so > that's good. > But every step shows successful; I don't see Stage 2 and 3 as red. > Is this possible to set separately? > > 3. And the echo 'Caught : ${exc}' doesn't show any message. Just shows > expression '${exc}' as text instead of the message itself. > > Thank you! > > try > { > node('testmachine') > { > stage ('Stage 1 - Setup and install') > { > try > { > echo 'Starting Stage 1' > currentBuild.result = 'SUCCESS' > } > catch(exc) > { > echo 'Caught-1 : ${exc}' > currentBuild.result = 'FAILED' > } > } > > stage ('Stage 2 - Test Set 1') > { > try > { > echo 'Starting Stage 2' > int i = 1 / 0; > currentBuild.result = 'SUCCESS' <- this can't happen in > this case > } > catch(exc) > { > echo 'Caught-2 : ${exc}' > currentBuild.result = 'FAILED' > } > } > > stage ('Stage 3 - Test Set 2') > { > try > { > echo 'Starting Stage 3' > int i = 1 / 0; > currentBuild.result = 'SUCCESS' <- this can't happen in > this case > } > catch(exc) > { > echo 'Caught-3 : ${exc}' > currentBuild.result = 'FAILED' > } > } > } > } > catch(exc) > { > echo 'Caught: ${exc}' > throw exc > } > > -- > 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/c817ba2b-925f-4fdf-9822-e92089637f30%40googlegroups. > com > <https://groups.google.com/d/msgid/jenkinsci-users/c817ba2b-925f-4fdf-9822-e92089637f30%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/HE1PR07MB0795F65BA415ABAEA28AA > A3590EC0%40HE1PR07MB0795.eurprd07.prod.outlook.com > <https://groups.google.com/d/msgid/jenkinsci-users/HE1PR07MB0795F65BA415ABAEA28AAA3590EC0%40HE1PR07MB0795.eurprd07.prod.outlook.com?utm_medium=email&utm_source=footer> > . > > 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/CABwQARtVxiXjybWOE-x2Rk3MZQOtJb_DzkWvTMgcSdv%3DLWiXqA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.