Nabaztag Plugin Question

Hello,

I'm writing a TeamCity Plugin for Nabaztag our build bunny ( nabaztag.com ).

I need a possibility to call a method the first time one of the builds failed and when all builds are fixed again.

I got it running with BuildServerAdapter but there is only the method buildChangedStatus, which is fired, when a builds changed from NORMAL to ERROR. How can I get access to other events?

Thanks very much for your help.
Simon

6 comments

There is buildFinished(SRunningBuild) event. You can watch it and analyze build status.

--
Pavel Sher

0

Looking into SRunningBuild I can say getBuildStatus. But then I'm missing the old status. I just want to alert, if there is a change in status.

That's why BuildServerAdapter.buildChangedStatus would fit my needs, if it just would do what the name says. Is there a possibility to access this information with BuildServerAdapter.buildFinished. I searched through the API documents and my debuggers breakpoint but just get the actual status.

Thanks
Simon

0

So you need to be notified if build changed status from failure to success? It seems to be rare case. Usually build that is starting to fail finally fails.

Anyway I think you can do the following, remember build status when build starts, then listen to messageReceived event and analyze whether build status has changed or not. Finally you should also listen to buildFinished event to check final build status.

--
Pavel Sher

0

Yes, it is also interesting that a build is fixed. You don't need to inform the others that a checkout is now possible without problems.

If our build bunny has its ears horizontal, there is a build problem. Else the ears are vertical (and I need a teamcity event to trigger this).

Also a hymn ("We are the champions", ...) could be played ;)

Update:
Just re-read your post. I thought it would be the status of the last finished build, which I get on buildChangedStatus. So this is just a status change in the running build?

Edited by: Simon Tiffert on Jul 3, 2008 12:59 PM

0

Yes, buildChangedStatus does not track latest builds, it just notifies about status changing in one concrete build.

I think it would be better for you to take a look at custom notifier plugin (jetbrains.buildServer.notification.Notificator interface). First of all it allows you to setup notification rules. You can setup a fake user for your rabbit and customize notification rules for this user. Your notifier will then be called according to these rules. For example, you'll be able to ask to be notified on successful build after the series of failed builds in specific configuration, or project without rewriting your plugin.

--
Pavel Sher

0

The notificator interface was the solution. I had found the tcgrowl-Plugin (http://code.google.com/p/tcgrowl) and get the Nabaztag running.

You can find the plugin at: http://code.google.com/p/buildbunny

0

Please sign in to leave a comment.