Created
December 30, 2010 20:50
-
-
Save potch/760282 to your computer and use it in GitHub Desktop.
Hudson Checker with growl notification
This file contains 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
#!/usr/bin/env python | |
from pyquery import PyQuery as pq | |
import re | |
import os | |
import time | |
HUDSON_URL = 'https://hudson.mozilla.org/job/amo-master/lastBuild/' | |
old_status = '' | |
while True: | |
doc = pq(url=HUDSON_URL) | |
h1 = doc('h1').html() | |
build_num = re.search('Build \#([0-9,]+)', h1).group(1) | |
build_status = doc('h1').find('img').attr('tooltip') | |
if build_status == "In progress": | |
build_progress = doc('h1').find('.progress-bar-done').attr('style') | |
build_progress = re.search('[0-9]+\%', build_progress).group() | |
os.system('growlnotify -m "Build %d: %s (%s)" Hudson' % | |
(int(build_num), build_status, build_progress)) | |
time.sleep(60) | |
else: | |
if build_status != old_status: | |
os.system('growlnotify -m "Build %d: %s" Hudson' % | |
(int(build_num), build_status)) | |
time.sleep(300) | |
old_status = build_status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tongue-in-cheek backgrounding instructions:
% ./hud.py&