Teamcity status macro for Trac

I had a need to print the build status of our teamcity server in trac. After researching various solutions, I figured a trac macro would best fit. It was a surprisingly simple solution so I figured I would share it here.

I created a file called “TeamCityStatus.py” and placed it into my trac/plugins folder.

from urllib import urlopen
from trac.wiki.macros import WikiMacroBase

class TeamCityStatusMacro(WikiMacroBase):
“”"Inserts the current build status into the wiki page.”"”

def expand_macro(self, formatter, name, args):
res=urlopen(‘example.org/teamcity/externalStatus.html?withCss=true’).read()
return res

Obviously change the URL open line to match your teamcity installed location.

Then inside any wiki page on your trac site, just place the macro command “[[TeamCityStatus]]”. You should be good to go!

This entry was posted in internet, programming, tech and tagged , , , . Bookmark the permalink.

One Response to Teamcity status macro for Trac

  1. Arie says:

    Thanks for that. Works great.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>