[Anthill-pro] Event Selector - comparing last build status

Steve Boone sbb at urbancode.com
Tue Feb 5 09:14:13 CST 2008


Uldis,

I have tried to add text to explain each method.




if (this is a complete workflow && it is not successful()) {
 result = true;  //Notify there is a failure
}
// Or if it's a success and the previous build was a failure

else if (If this is a workflow && and this workflow is complete && and this
workflow is a success {

       currentSuccess = This current buildlife
       lastFailure =Get the most recent failure.
       lastSuccess = Get the most recent success
       if (lastFailure != null) { //check to see there has been a failure in
the past
           if (lastSuccess == null || lastFailure.getStartDate().after(
lastSuccess.getStartDate())) { //check to see that there has been a previous
success, if not, this is a fixed build (it would be the first time it was
successful, so we notify) OR if the last
               // This is a build
fix
// failure happened after the last success, then we want to notify, because
there has been a failure since the previous success.  The build is fixed,
notify.
               result = true;
           }
       }
}




On 2/5/08, Uldis Karlovs-Karlovskis <uldisk at ctco.lv> wrote:
>
>  No no, it is correct ¨C first success after failure. What I`m saying, it
> seems to me that this script is triggering on every success build if there
> is any failed before (no matter if this is first, second etc success build).
> If I`m wrong, please explain me how these methods work.
>
>
>
> Uldis Karlovs-Karlovskis, C. T. Co
>
> *uldis.karlovs-karlovskis at ctco.lv* <uldis.karlovs-karlovskis at ctco.lv>
>
>
>
> -----Original Message-----
> *From:* anthill-pro-bounces at lists.urbancode.com [mailto:
> anthill-pro-bounces at lists.urbancode.com] *On Behalf Of *Steve Boone
> *Sent:* otrdiena, 2008. gada 5. febru¨¡r¨© 16:52
> *To:* AnthillPro user and support list.
> *Cc:* AnthillPro user and support list.
> *Subject:* Re: [Anthill-pro] Event Selector - comparing last build status
>
>
>
> Uldis,
>
> That is correct, perhaps we misunderstood the scenario?  We thought the
> goal was to notify on failures, and first success.  We interpreted first
> success, to mean the first success after a failure.
>
> On 2/5/08, *Uldis Karlovs-Karlovskis* <uldisk at ctco.lv> wrote:
>
> How does script knows if there was not one build fix in the middle
> already? Imo it will send mails on every Success build if there is any
> Failed build before it¡­ Clear it to me if I`m wrong.
>
>
>
> Uldis Karlovs-Karlovskis, C. T. Co
>
> *uldis.karlovs-karlovskis at ctco.lv* <uldis.karlovs-karlovskis at ctco.lv>
>
>
>
> -----Original Message-----
> *From:* anthill-pro-bounces at lists.urbancode.com [mailto:
> anthill-pro-bounces at lists.urbancode.com] *On Behalf Of *Steve Boone
> *Sent:* pirmdiena, 2008. gada 4. febru¨¡r¨© 20:28
> *To:* AnthillPro user and support list.
>
> *Cc:* AnthillPro user and support list.
> *Subject:* Re: [Anthill-pro] Event Selector - comparing last build status
>
>
>
> Curtis,
>
> I didn't have a chance to test this script, but I think with these
> changes, you would get the functionality you were looking for.
>
>
> import com.urbancode.anthill3.domain
>
> .workflow.*;
> import com.urbancode.anthill3.domain.buildlife.*;
>
> result = false;
>
> // Mail if there's a failure
> if (event instanceof WorkflowEvent &&
>    event.getCase().isComplete() &&
>    !event.getCase().getStatus().isSuccess()) {
>  result = true;
> }
> // Or if it's a success and the previous build was a failure
> else if (event instanceof WorkflowEvent &&
>    event.getCase().isComplete() &&
>    event.getCase().getStatus().isSuccess()) {
>        currentSuccess = event.getCase().getBuildLife();
>        lastFailure =BuildLifeFactory.getInstance
> ().restorePriorMostRecentFailureForProfile(currentSuccess,
> currentSuccess.getProfile());
>        lastSuccess =BuildLifeFactory.getInstance
> ().restorePriorMostRecentSuccessForProfile(currentSuccess,
> currentSuccess.getProfile());
>        if (lastFailure != null) {
>            if (lastSuccess == null || lastFailure.getStartDate().after(
> lastSuccess.getStartDate())) {
>                // This is a build fix
>                result = true;
>            }
>        }
> }
>
>
>
> On 2/4/08, *Steve Boone* <sbb at urbancode.com> wrote:
>
> Curtis,
>
> This should work.
>
>
> import com.urbancode.anthill3.domain.workflow.*;
> import com.urbancode.anthill3.domain.buildlife.*;
>
> result = false;
>
> if (event instanceof WorkflowEvent &&
>     event.getCase().isComplete() &&
>     event.getCase().getStatus().isSuccess()) {
>         currentSuccess = event.getCase().getBuildLife();
>         lastFailure = BuildLifeFactory.getInstance().restorePriorMostRecentFailureForProfile(currentSuccess,
> currentSuccess.getProfile());
>         lastSuccess = BuildLifeFactory.getInstance().restorePriorMostRecentSuccessForProfile(currentSuccess,
> currentSuccess.getProfile());
>         if (lastFailure != null) {
>             if (lastSuccess == null || lastFailure.getStartDate().after(
> lastSuccess.getStartDate())) {
>                 // This is a build fix
>                 result = true;
>             }
>         }
> }
>
> return result;
>
> On 2/1/08, *Yanko, Curtis* <curt_yanko at uhc.com> wrote:
>
>  Has there been headway on this? I have a team that wants Failures and
> first Success. While I fundamentally disagree with this approach they are
> the customer.
>
>
>
> ===
>
> -Curt
>
> W: 860.702.9059
>
> M: 860.881.2050
>
>
>
>
>  ------------------------------
>
> *From:* anthill-pro-bounces at lists.urbancode.com [mailto:
> anthill-pro-bounces at lists.urbancode.com] *On Behalf Of *Wes Bramhall
> *Sent:* Wednesday, January 30, 2008 5:33 PM
> *To:* AnthillPro user and support list.
> *Subject:* [Anthill-pro] Event Selector - comparing last build status
>
>  I am trying to make a custom Event Selector that will notify if the
> current build is a success and the previous one is a failure. How would I
> access the previous build life to determine if it was a failure? I don't see
> a way to access previous build lives except by status.
>
>
>
> Thanks,
>
> -Wes
>
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity to
> which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.
>
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
>
>
>
>
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
>
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20080205/03f4db4f/attachment-0005.htm


More information about the Anthill-pro mailing list