Skip to content

Instantly share code, notes, and snippets.

@kiowa
Created October 15, 2010 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiowa/628236 to your computer and use it in GitHub Desktop.
Save kiowa/628236 to your computer and use it in GitHub Desktop.
Kibot script for checking Bamboo for failed builds.
"""
Kibot script for checking Bamboo for failed builds.
"""
import kibot.BaseModule
import feedparser
import re
from kibot.m_irclib import Timer
failure = re.compile("(.*) has FAILED : Updated by \<a href.*\>(.*)\</a\>")
class bamboo(kibot.BaseModule.BaseModule):
_stash_format = 'repr'
_stash_attrs = ['notified']
def __init__(self, bot):
self.bot = bot
self.notified = []
self._unstash()
self.timer = Timer(1, self.failed_builds, args=(bot,), kwargs={}, fromnow=1, repeat=60)
self.bot.set_timer(self.timer)
def _unload(self):
self._stash()
self.bot.del_timer(self.timer)
def failed_builds(self, bot):
d = feedparser.parse("http://bamboo/rss/createAllBuildsRssFeed.action?feedType=rssFailed")
for entry in d.entries:
m = failure.match(entry.title)
if m:
build = m.group(1)
user = m.group(2)
if not build in self.notified:
bot.conn.privmsg("#it-ua", "%s, you broke the build %s." % (user, build))
self.notified.append(build)
self._stash()
return 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment