What about simply guard build execution in your flow? I've assumed you're going 
to script your things in a jenkins job. Thus you shall be able to guard jobs as 
follows:

parallel (
    {
        guard {
            build("job1A")
        } rescue {
            build("job1B")
        }
    },
    {
        retry 3, {
            build("job2")
        }
    }
Alternative would be the following:
ignore(FAILURE) {
    build( "send_twitter_notification" )
}At least your job will return and you'll be able to do your post_mortem 
steps;-)Take a look at 
https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+PluginJoe


        processed by David.fx 
Subject: RE: Chicken-Egg issue with job references in Build Flow (10-Aug-2015 
19:53)
From:    Ginga, Dick <dick.gi...@perkinelmer.com>
To:      j...@huber-online.com


The only time I have seen this is if the downstream job never actually 
starts…e.g. Groovy error. A job that fails a step will return a handle.
 
So I have never had to do defensive programming around this. I could always fix 
the problem.
 
From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Adam Daughterson
Sent: Monday, August 10, 2015 1:38 PM
To: Jenkins Users
Subject: Chicken-Egg issue with job references in Build Flow
 
Howdy Group,

I've got a build flow in which things can, and do go wrong.

When things go wrong with a downstream job I'm running, and I've created a 
reference to the build, the reference winds up being null since an exception is 
thrown so far downstream that the build() step is never completed, thus no 
handy reference to the build.

Is there any way I can tickle the DSL to wait to throw that exception until I 
return a reference to the failed build, so I can mine it for useful info after 
it fails?

In pseudocode:

parallel {
    def passingJob = build("SomePassingJob")

    // Works for passingJob, but not for failingJob since the exception 
prevents build() from returning valid reference
    postProcessing(passingJob)
    def jobShouldFail = build("SomeFailingJob")
    postProcessing(failingJob)
}

def SomePostProcessing(def job)
{
    println job.getProject().getName()
}


Anyone have any suggestions as to what I can do here?  The exception thrown is 
really devoid of anything useful, and I'm half-tempted to modify the exception 
handler in the Build Flow plugin to stuff the reference to the job into the 
thrown exception.

As always, all help is appreciated.

Adam
-- 
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/81ebeeb2-7249-447a-afe7-5ed01d4bd610%40googlegroups.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/6C6EE445A6F6CE4E8A0FFB51B071A4E2D8653F2D%40AMERMBX02.PERKINELMER.NET.
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/DIIE.0000A47F0076A709%40192.168.11.6.
For more options, visit https://groups.google.com/d/optout.

Reply via email to