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.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s