views:

440

answers:

4

Hi there,

I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.

I am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget but in XML form. (FYI, the status widget page is not XHTML - tried that!)

I wonder if anyone has across anything that could assist?

Kind Regards, David Christiansen

+1  A: 

Edit: as you point out, the RSS feed from TeamCity only includes completed builds.

One possibility would be to grab the HTML from the project you're interested in's details page, and then pull the current status from the top entry in the table of builds there.

Another option: have you considered using the Jabber or email notification system? It has more fine-grained event notification:

  • build starts
  • build succeeds or fails

both generate notifications, from which you can infer build status. Automation around email is straightforward, and Jabber is an open standard so I imagine this is reasonably easy too.

Any of these options would need a little wrapping code to convert to RSS.

Dan Vinton
Thanks for your response, however, the RSS option in "My Settings and Tools" displays historical information - not a 'Current Build Status' which is what I am looking for.
David Christiansen
A: 

Does this summary of a standard XML status format describe what you mean? I'm pretty sure TeamCity can produce this format, but not exactly sure how. Hudson does it with a URL like http://my.hudson.server.example.com:3030/cc.xml.

Douglas Squirrel
That hudson link is not working...
Paulo Manuel Santos
The first link does work for me.The second link is an example to show you the form of status links. It's not supposed to work. (URLs ending in example.com are always examples. Just visit one, e.g. http://example.com, for further explanation.)
Douglas Squirrel
+2  A: 

I've been working on this problem for a little while now

Here's a post showing you how to login to teamcity in code in c#

then its just a matter of using HTMLAgilityPack to look at the table.

if you turn on guest access its even easier. I'm cleaning up the code for release shortly if that helps. If your developing in another language I can help there too.

Scott Cowan
+1  A: 

Probably it is better to write your own plugin. If you know Java of course. You can create custom web controller and bind it to the url you like, this controller can accept buildId parameter, search for a build (SBuildServer.findBuildInstanceById()) and output XML.

Take a look at HelloUserController.java which is in the samplePlugin.zip bundled with TeamCity (TeamCity/devPackage).

Also its worth to check sources of some of the TeamCity plugins: http://www.jetbrains.net/confluence/display/TW/TeamCity+Plugins

Pavel Sher