Buildflow/workflow executes code block till next build step even after failure

27 views
Skip to first unread message

Jayan M N

unread,
Mar 13, 2016, 4:20:54 AM3/13/16
to Jenkins Users

Here is my FlowScript. `dev.AlwaysFail` is job that will always fail.


def afterFail=false;
def afterFail_2= false;
guard {
    b = build( "dev.AlwaysFail" )
    out.println ("must not appear") //executed even after the error.
    afterFail = true; //executed even after the error.
  
    b = build( "dev.AlwaysFail" )  
    afterFail_2 = true;
} rescue {
    out.println afterFail
    out.println afterFail_2
}

Result from execution
=============
guard {
    Schedule job dev.AlwaysFail
    Build dev.AlwaysFail #3 started
    dev.AlwaysFail #3 completed  : FAILURE
must not appear
} rescue {
true
false
}
Finished: FAILURE
=====================


Is there a way to directly execute "guard" when build triggered from flow execute?

Thanks,
Jayan

Christopher Orr

unread,
Mar 16, 2016, 8:38:24 PM3/16/16
to jenkins...@googlegroups.com
Sorry, I don't have a good answer, but AFAIK the Build Flow plugin isn't
really in development any more — you should be able to achieve what
you're looking for with the Pipeline plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin

Regards,
Chris


On 13/03/16 09:20, Jayan M N wrote:
>
> Here is my FlowScript. `dev.AlwaysFail` is job that will always fail.
>
>
> def afterFail=false;
> def afterFail_2= false;
> guard {
> b = build( "dev.AlwaysFail" )
> out.println ("must not appear")//executed even after the error.
> afterFail = true; //executed even after the error.
> b = build( "dev.AlwaysFail" )
> afterFail_2 = true;
> } rescue {
> out.println afterFail
> out.println afterFail_2
> }
>
> Result from execution
> =============
>
> guard {
> Schedule jobdev.AlwaysFail <http://localhost:8080/job/dev.AlwaysFail/>
> Builddev.AlwaysFail #3 <http://localhost:8080/job/dev.AlwaysFail/3/> started
> dev.AlwaysFail #3 <http://localhost:8080/job/dev.AlwaysFail/3/> completed : FAILURE
> must not appear
> } rescue {
> true
> false
> }
> Finished: FAILURE
>
> =====================
>
>
>
> Is there a way to directly execute "guard" when build triggered from flow execute?
>
>
> Thanks,
>
> Jayan
>
> --
> 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-use...@googlegroups.com
> <mailto:jenkinsci-use...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/3a5b966a-410d-4ea1-ba1c-da8e9cb93083%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/3a5b966a-410d-4ea1-ba1c-da8e9cb93083%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages