<div dir="ltr">Hello there,<div><br></div><div>long time ago, I had started to look into getting messages from Buildbot for "desktop notifications". this. For some weeks already, I am now using this with good results:</div><div><br></div><div><div>from buildbot.plugins import status</div><div><br></div><div>def onStatusPush(self):</div><div>    chunk = self.queue.popChunk()</div><div>    for part in chunk:</div><div>        event_type = part["event"]</div><div><br></div><div>        if event_type == "buildFinished":</div><div>            builder_name = part["payload"]["build"]["builderName"]</div><div>            slave_name = part["payload"]["build"]["slave"]</div><div>            build_result = " ".join(part["payload"]["build"]["text"])</div><div><br></div><div>            for p in part["payload"]["build"]["properties"]:</div><div>                if p[0] == "got_revision":</div><div>                    got_revision = p[1]</div><div>                    break</div><div>            else:</div><div>                got_revision = "no revision"</div><div><br></div><div>            try:</div><div>                logs = part["payload"]["build"]["logs"]</div><div>            except Exception:</div><div>                logs = [["made up", "No log information found"]]</div><div><br></div><div>            urls = []</div><div>            for log_name, log_url in logs:</div><div>                urls.append(log_url)</div><div><br></div><div>            urls = "\n".join(urls)</div><div><br></div><div>            if "failed" in build_result:</div><div>                message = """</div><div>name: %(builder_name)s</div><div>slave: %(slave_name)s</div><div>build_result: %(build_result)s</div><div>rev: %(got_revision)s</div><div><br></div><div>%(urls)s</div><div>    """ % locals()</div><div><br></div><div>                subprocess.check_call(</div><div>                    [</div><div>                        "/usr/share/doc/python-xmpp/examples/xsend.py",</div><div>                        "<a href="mailto:redacted@test.com">redacted@test.com</a>",</div><div>                        message</div><div>                    ]</div><div>                )</div><div><br></div><div>    self.queueNextServerPush()</div><div><br></div><div>sp = status.StatusPush(</div><div>    serverPushCb = onStatusPush,</div><div>    bufferDelay  = 0.5,</div><div>    retryDelay   = 5</div><div>)</div><div>c['status'].append(sp)</div></div><div><br></div><div>I think this might be useful to others too. As you can see, the bulk of it</div><div>is about parsing the data and creating the message to send. The</div><div>xsend from python-xmpp Debian package works fine for me, and just</div><div>takes a ".xsend" in buildmaster user home directory with content like</div><div>this:</div><div><br></div><div><div>JID=<a href="http://buildbot@test.com/buildmaster">buildbot@test.com/buildmaster</a></div><div>PASSWORD=cleartext_password</div></div><div><br></div><div>And that was it. Works great for me. Let me know if you have any</div><div>comments or enhancements to this. I am not sure if a chat room</div><div>would work as a target, that surely would be nice too. I didn't try</div><div>that yet.</div><div><br></div><div>If anybody wants to take it from here and integrate into Buildbot,</div><div>go ahead, assume public domain for my copyright there.</div><div><br></div><div>Yours,</div><div>Kay</div></div>