I'm pretty sure it will take the value of the last expression. Sent from my Windows Phone ------------------------------ From: AdvanTiSS Sent: 11/9/2012 7:12 AM To: jenkinsci-users@googlegroups.com Cc: AdvanTiSS; Varghese Renny Subject: Re: Editable Email Notification. How do I set conditional Email
Are you sure??? ExtendedEmailPublisher.java private boolean executePresendScript(AbstractBuild<?, ?> build, BuildListener listener, MimeMessage msg) throws RuntimeException { ..... Object output = shell.evaluate(presendScript); if(output!=null) { pw.println("Result: "+output); cancel = ((Boolean)shell.getVariable("cancel")).booleanValue(); } .... } On Friday, November 9, 2012 4:03:58 PM UTC+2, slide wrote: > > No, it doesnt > > Sent from my Windows Phone > ------------------------------ > From: AdvanTiSS > Sent: 11/9/2012 12:04 AM > To: jenkins...@googlegroups.com <javascript:> > Cc: Varghese Renny > Subject: Re: Editable Email Notification. How do I set conditional Email > > Pre-send script must have return statement > > if(cause) > { > cancel=true > } > return cancel > > On Friday, November 9, 2012 7:31:34 AM UTC+2, slide wrote: >> >> Logic? >> MIME-Version: 1.0 >> Content-Type: multipart/alternative; >> boundary=f46d044306707d987804ce08ac46 >> >> --f46d044306707d987804ce08ac46 >> Content-Type: text/plain; charset="utf-8" >> Content-Transfer-Encoding: 7bit >> >> Also what do you mean based on the results? Based on the return code? >> Based on some output from an app? >> >> Sent from my Windows Phone >> From: Varghese Renny >> Sent: 11/8/2012 9:49 PM >> To: jenkins...@googlegroups.com >> Subject: Re: Editable Email Notification. How do I set conditional >> Email Logic? >> Hi Tom, >> >> In presend script you can mention like this.. >> >> import hudson.model.Cause.UpstreamCause >> def cause = build.causes.find { >> if(it instanceof hudson.model.Cause.UpstreamCause) { >> return true >> } >> return false >> } >> >> if(cause) >> { >> cancel=true >> } >> >> I don't know how it cancel based on shell..Probably you can check some >> api's. >> What's your shell script actually doing? >> >> Regards, >> varghese >> >> On Fri, Nov 9, 2012 at 4:45 AM, Tom80112 <nez...@yahoo.com> wrote: >> >> > Inside my "execute shell" window I perform script logic. >> > >> > Based on the results within the "execute shell" window, I may or may >> > not want to send email via the Jenkins Email Extension Plugin. >> > >> > I have read that I can set up a pre-send script to cancel email being >> > set up by setting cancel=true. >> > >> > My question is how how I set cancel=true based upon the outcome of >> > logic within the "execute shell" window? There is no way to pass a >> > variable from the "execute shell" window to the pre-send script.. ???? >> > >> > Please Help.. :) >> > >> > >> > >> > -- >> > View this message in context: >> > >> http://jenkins.361315.n4.nabble.com/Editable-Email-Notification-How-do-I-set-conditional-Email-Logic-tp4645626.html >> > Sent from the Jenkins users mailing list archive at Nabble.com. >> > >> >> --f46d044306707d987804ce08ac46 >> Content-Type: text/html; charset="utf-8" >> Content-Transfer-Encoding: quoted-printable >> >> <html><head><meta content=3D"text/html; charset=3Dutf-8" >> http-equiv=3D"Cont= >> ent-Type"></head><body><div><div style=3D"font-family: >> Calibri,sans-serif; = >> font-size: 11pt;">Also what do you mean based on the results? Based on >> the = >> return code? Based on some output from an app?<br><br>Sent from my >> Windows = >> Phone<br></div></div><hr><span style=3D"font-family: Tahoma,sans-serif; >> fon= >> t-size: 10pt; font-weight: bold;">From: </span><span >> style=3D"font-family: = >> Tahoma,sans-serif; font-size: 10pt;">Varghese Renny</span><br><span >> style= >> =3D"font-family: Tahoma,sans-serif; font-size: 10pt; font-weight: >> bold;">Se= >> nt: </span><span style=3D"font-family: Tahoma,sans-serif; font-size: >> 10pt;"= >> >11/8/2012 9:49 PM</span><br><span style=3D"font-family: >> Tahoma,sans-serif;= >> font-size: 10pt; font-weight: bold;">To: </span><span >> style=3D"font-family= >> : Tahoma,sans-serif; font-size: 10pt;">jenkins...@googlegroups.com</sp= >> an><br><span style=3D"font-family: Tahoma,sans-serif; font-size: 10pt; >> font= >> -weight: bold;">Subject: </span><span style=3D"font-family: >> Tahoma,sans-ser= >> if; font-size: 10pt;">Re: Editable Email Notification. How do I set >> conditi= >> onal Email Logic?</span><br><br></body></html>Hi Tom,<br><br>In presend >> scr= >> ipt you can mention like this..<br><br>import >> hudson.model.Cause.UpstreamCa= >> use<br>=C2=A0def cause =3D build.causes.find >> {<br>=C2=A0=C2=A0=C2=A0=C2=A0= >> =C2=A0 if(it instanceof hudson.model.Cause.UpstreamCause) >> {<br>=C2=A0=C2=A0= >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return true<br> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return >> f= >> alse<br>=C2=A0}<br><br>if(cause)<br>{<br>cancel=3Dtrue<br>}<br><br>I >> don= >> 9;t know how it cancel based on shell..Probably you can check some >> api'= >> s.<br> >> What's your shell script actually doing?<br> >> <br>Regards,<br>varghese <br><br><div class=3D"gmail_quote">On Fri, Nov >> 9, = >> 2012 at 4:45 AM, Tom80112 <span dir=3D"ltr"><<a href=3D"mailto: >> nez...@ya= >> hoo.com" target=3D"_blank">nez...@yahoo.com</a>></span> >> wrote:<br><block= >> quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px >> #ccc= >> solid;padding-left:1ex"> >> Inside my "execute shell" window I perform script logic.<br> >> <br> >> Based on the results within the "execute shell" window, I may >> or = >> may<br> >> not want to send email via the Jenkins Email Extension Plugin.<br> >> <br> >> I have read that I can set up a pre-send script to cancel email being<br> >> set up by setting cancel=3Dtrue.<br> >> <br> >> My question is how how I set cancel=3Dtrue based upon the outcome of<br> >> logic within the "execute shell" window? =C2=A0 There is no way >> t= >> o pass a<br> >> variable from the "execute shell" window to the pre-send >> script..= >> ????<br> >> <br> >> Please Help.. :)<br> >> <br> >> <br> >> <br> >> --<br> >> View this message in context: <a href=3D" >> http://jenkins.361315.n4.nabble.co= >> m/Editable-Email-Notification-How-do-I-set-conditional-Email-Logic-tp464562= >> >> 6.html" target=3D"_blank">http://jenkins.361315.n4.nabble.com/Editable-Emai= >> >> l-Notification-How-do-I-set-conditional-Email-Logic-tp4645626.html<http://jenkins.361315.n4.nabble.com/Editable-Emai=l-Notification-How-do-I-set-conditional-Email-Logic-tp4645626.html></a><br> >> >> >> Sent from the Jenkins users mailing list archive at Nabble.com.<br> >> </blockquote></div><br> >> >> --f46d044306707d987804ce08ac46-- >> >