Created
October 15, 2010 14:07
-
-
Save kiowa/628236 to your computer and use it in GitHub Desktop.
Kibot script for checking Bamboo for failed builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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