phase1: implement IRC notifications
authorJo-Philipp Wich <jo@mein.io>
Fri, 27 May 2016 12:39:24 +0000 (14:39 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 27 May 2016 12:39:24 +0000 (14:39 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/config.ini.example
phase1/master.cfg

index 005b78136b2cb508a284425b0f939794d190625d..de77eccf43744ef001b47f4e7ad014774611101f 100644 (file)
@@ -9,6 +9,13 @@ bind = tcp:8010:interface=127.0.0.1
 user = example
 password = example
 
+[irc]
+host = irc.freenode.net
+port = 6667
+channel = #example-channel
+nickname = example-builder
+password = example
+
 [repo]
 url = https://git.lede-project.org/source.git
 
index c06b15f2134c6fb93cf77f14ed35d2a9f91dfc5f..69f3b7870348d7aa11dc79900e9c10ec55ed8e85 100644 (file)
@@ -493,6 +493,34 @@ if ini.has_option("status", "bind"):
        else:
                c['status'].append(html.WebStatus(http_port=ini.get("status", "bind")))
 
+
+from buildbot.status import words
+
+if ini.has_option("irc", "host") and ini.has_option("irc", "nickname") and ini.has_option("irc", "channel"):
+       irc_host = ini.get("irc", "host")
+       irc_port = 6667
+       irc_chan = ini.get("irc", "channel")
+       irc_nick = ini.get("irc", "nickname")
+       irc_pass = None
+
+       if ini.has_option("irc", "port"):
+               irc_port = ini.getint("irc", "port")
+
+       if ini.has_option("irc", "password"):
+               irc_pass = ini.get("irc", "password")
+
+       irc = words.IRC(irc_host, irc_nick, port = irc_port, password = irc_pass,
+                       channels = [{ "channel": irc_chan }],
+                       notify_events = {
+                         'exception': 1,
+                         'successToFailure': 1,
+                         'failureToSuccess': 1
+                       }
+       )
+
+       c['status'].append(irc)
+
+
 ####### PROJECT IDENTITY
 
 # the 'title' string will appear at the top of this buildbot