Thank you for the help; I appreciate it. :-)
On Monday, December 18, 2017 at 11:12:46 AM UTC+1, NickA wrote:
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/8a980762-1b96-4882-b137-e625dcac05ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.