Take a look at src/test/groovy/com/cloudbees/plugins/flow/AbortTest.groovy 
 - this should say that it is possible to do what you want :-)


On Tuesday, 29 October 2013 02:43:19 UTC-4, asmundo wrote:
>
> On Tue, Oct 29, 2013 at 4:16 AM, James Nord (jnord) 
> <jn...@cisco.com<javascript:>
> > wrote:
>
>>  The changes I have put in to support this are not in a release version 
>> of the buildflow – so you will need to download source and compile, or grab 
>> it from the Jenkins ci instance.
>>
>
> I forgot to state that I am did this. Sorry about that.  I am running:
>
>    * 305af7f Merge pull request #37 from mattiasbpersson/master 
>    * build-flow-plugin:0.11-SNAPSHOT
>
> I did very much like the groovy shell evaluation!
>
> Asmund
>
>
>
>
>  
>>
> ****
>>
>> ** **
>>
>> /James****
>>
>> ** **
>>   
>> *From:* jenkins...@googlegroups.com <javascript:> [mailto:
>> jenkins...@googlegroups.com <javascript:>] *On Behalf Of *Åsmund Østvold
>> *Sent:* 28 October 2013 17:34
>>
>> *To:* jenkins...@googlegroups.com <javascript:>
>> *Subject:* Re: build flow, early exit from parallel construct?****
>>
>>  ** **
>>  
>> Thank you James,  ****
>>  
>> ** **
>>  
>> I finally freed up some time and was able do a new stab at this.  I have 
>> inlined some questions and feedback.****
>>  
>> ** **
>>  
>> On Fri, Oct 25, 2013 at 6:33 AM, James Nord (jnord) 
>> <jn...@cisco.com<javascript:>> 
>> wrote:****
>>  
>>  KillRunningjobs is called internally if the flow is aborted (or one of 
>> the jobs is aborted).****
>>
>> Internallyt this is handled by catching either  (IIRC) a 
>> JobAborteException (or also an IOException).****
>>  
>>  ** **
>>  
>> I did search for 10 minutes for "JobAborteException" or something close 
>> to this. But my Jenkins/Java knowledge is limite...****
>>  
>>  ****
>>  
>>  The IOException will show a stack trace in your console output – wheres 
>> the jobAbortEx will just show “Aborted” (and the cause if you set one),**
>> **
>>  
>>  ** **
>>  
>> I did try the blow but was not able to abort flow job. Job 'pass' takes 
>> 20s and job 'fail' taks only 5s:****
>>  
>> ** **
>>   
>> parallel(****
>>  
>>  {  b = build("pass");****
>>  
>>     if (b.getResult() == Result.FAILURE) {****
>>  
>>         throw new java.io.IOException("foo")****
>>  
>>     } },****
>>  
>>  {  b = build( "fail" );****
>>  
>>     if (b.getResult() == Result.FAILURE) {****
>>  
>>         throw new java.io.IOException("foo")****
>>  
>>     }}****
>>  
>> )****
>>   
>> ** **
>>  
>> Console output:****
>>  
>> ** **
>>  
>> ** **
>>
>> parallel {****
>>
>>     Schedule job fail <http://ao:8080/job/fail/>****
>>
>>     Schedule job pass <http://ao:8080/job/pass/>****
>>
>>     Build fail #40 <http://ao:8080/job/fail/40/> started****
>>
>>     Build pass #33 <http://ao:8080/job/pass/33/> started****
>>
>>     fail #40 <http://ao:8080/job/fail/40/> completed  : FAILURE****
>>
>>     pass #33 <http://ao:8080/job/pass/33/> completed ****
>>
>> }****
>>
>>  ** **
>>
>>   I am probably doing something wrong but I am not able to see it. Any 
>> help would be appreciated. ****
>>  
>>  ****
>>  
>>  So just throw one of those.  I guess I should add this to the 
>> extensions so you can just call ext.abortFlow(“Reason”) J****
>>  
>>  ** **
>>  
>> With my limited understanding I believe this would be very good to have. 
>> If you add this could you consider adding something like:****
>>  
>> ** **
>>  
>>   ext.failFlow(“Reason”)****
>>  
>> ** **
>>  
>> It should do the same was for abortFlow("foo") but fail the build. For my 
>> use case this would "keep" the overall status as if all the jobs in the 
>> parallel section had finished. To also cover 'UNSTABLE' and 'SUCCESS' could 
>> the generalisation be exposing something like:****
>>  
>> ** **
>>  
>>    terminateFlow(Result r, String s)****
>>  
>> ** **
>>  
>> ?****
>>  
>>  ****
>>  
>>  Also no need to check the string – check getResult() == Result.FAILURE 
>> or getResult().isWorseOrEqual(Result.FAILURE)****
>>  
>>  ** **
>>  
>> Thanks for this. ****
>>  
>>  ****
>>  
>> Asmund****
>>  
>> ** **
>>  
>> -- ****
>>  
>> dyslectic****
>>   
>> -- 
>> 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 <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.****
>>
>>   -- 
>> 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 <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to