def setup(c, config): c["status"] = [] authz_cfg = authz.Authz(forceBuild=True, forceAllBuilds=True, stopBuild=True, stopAllBuilds=True, cancelPendingBuild=True, stopChange=True) c["status"].append(html.WebStatus(http_port=config["web_port"], authz=authz_cfg, change_hook_dialects={"base": True})) c["status"].append(words.IRC(host="irc.freenode.net", nick="sbbot", channels=["#sugar"], categories=["upstream"], notify_events={"successToFailure": 1, "failureToSuccess": 1})) c["status"].append(MailNotifier(fromaddr="*****@*****.**", mode=["problem"], lookup="sugarlabs.org", categories=["upstream"], extraRecipients=["*****@*****.**"])) c["status"].append(HttpStatusPush(serverUrl=str(config["status_url"])))
def add_status_irc(self, host=None, nick=None, channels=None, password=None, **kwargs): """Add an IRC status target. """ kwargs['host'] = host kwargs['nick'] = nick kwargs['channels'] = channels if password is None: try: import private_passwords password = private_passwords.irc_passwords[nick] except ImportError: raise ConfigError( "Missing password file: can't get password for IRC bot %r" % nick) except AttributeError: raise ConfigError( "Missing irc_password dictionary in password file") except KeyError: raise ConfigError("Missing password for IRC bot %r" % nick) if password is not None: kwargs['password'] = password from buildbot.status import words self.c['status'].append(words.IRC(**kwargs))
def get_other_irc(): from buildbot.status import words return words.IRC(host='<IRC server redacted>', nick='<IRC nick redacted>', channels=['<IRC channels redacted>'], notify_events={ 'started': 0, 'finished': 0, 'failure': 0, 'success': 0, 'exception': 0 })
def IRCStatus(cfg): irc_conf = cfg.get('irc') network = irc_conf['network'] channel = irc_conf['channel'] nickname = irc_conf['nickname'] irc = words.IRC(network, nickname, channels = [{'channel': channel}], notify_events = { 'success': 1, 'failure': 1, 'exception': 1, 'successToFailure': 1, 'failureToSuccess': 1 }) return irc
def makeIRC(self, **kwargs): kwargs.setdefault('host', 'localhost') kwargs.setdefault('nick', 'russo') kwargs.setdefault('channels', ['#buildbot']) self.factory = None def TCPClient(host, port, factory): client = mock.Mock(name='tcp-client') client.host = host client.port = port client.factory = factory # keep for later self.factory = factory self.client = client return client self.patch(internet, 'TCPClient', TCPClient) return words.IRC(**kwargs)
def get_status(options): """ Returns a list of status targets for the build master. """ # Load the users that are allowed to perform authenticated # actions from the configuration auth_users = [] if options.http_users is not None: for pair in options.http_users.split(","): user, password = pair.split(":") auth_users.append((user, password)) # Setup the rules for who can do what to the WebStatus authz = Authz(auth=BasicAuth(auth_users), gracefulShutdown=False, forceBuild='auth', forceAllBuilds='auth', pingBuilder=True, stopBuild='auth', stopAllBuilds='auth', cancelPendingBuild='auth', stopChange='auth', cleanShutdown=False) # The web status gives us the nice web interface to our buildbot web_status = html.WebStatus(http_port=options.web_port, authz=authz, order_console_by_time=True, change_hook_dialects=dict(github=True)) # Hook up an IRC bot into our channel irc = words.IRC("irc.freenode.net", "vagrant-ci", channels=[{ "channel": "#vagrant" }], notify_events={ 'exception': 1, 'successToFailure': 1, 'failureToSuccess': 1 }) return [web_status, irc]
WebStatus( http_port= "ssl:port=8443:privateKey=/etc/ssl/server.key:certKey=/etc/ssl/server.crt:extraCertChain=/etc/ssl/server.ca-bundle", authz=authz_cfg, change_hook_auth=["file:changehook.passwd"], change_hook_dialects={'github': {}}, order_console_by_time=True)) # IRC bot ircbot = json.load(open("ircbot.json")) status.append( words.IRC(host=ircbot['server'], nick=ircbot['nickname'], password=ircbot['password'], channels=ircbot['channels'], notify_events={ 'successToException': 1, 'successToFailure': 1, 'failureToSuccess': 1, 'exceptionToSuccess': 1 })) # GitHub Status tokens = json.load(open("tokens.json")) for repo in tokens: gs = GitHubStatus(token=tokens[repo]["token"], repoOwner=tokens[repo]["owner"], repoName=repo, sha=Interpolate("%(src:" + repo + ":revision)s"), startDescription='DEV build started.', endDescription='DEV build done.') status.append(gs)
status = [] users = [('dev', 'bbot!') # it's not *that* secret.. ] authz = Authz(auth=BasicAuth(users), forceBuild='auth', forceAllBuilds='auth', gracefulShutdown='auth') status.append( html.WebStatus( # localhost is not available in the jail http_port="tcp:8010:interface=192.168.80.239", authz=authz, order_console_by_time=True, revlink="http://github.com/buildbot/buildbot/commit/%s", changecommentlink=(r'\b#(\d+)\b', r'http://buildbot.net/trac/ticket/\1', r'Ticket \g<0>'), change_hook_dialects={'github': {}})) status.append( words.IRC(host="irc.freenode.net", nick="bb-meta", notify_events={ 'successToFailure': 1, 'failureToSuccess': 1 }, channels=["#buildbot"]))
def __init__(self, name, homepage, secretsfile="~/myconfig.json", *args, **kwargs): dict.__init__(self, *args, **kwargs) # Find the directory containing this .py file thisfile = __file__ thisfile = thisfile.replace(".pyc", ".py") try: thisfile = os.readlink(thisfile) except: pass dir = os.path.join(os.path.dirname(thisfile)) masterjson = json.load(open(os.path.join(dir, "master.json"))) # Lots of unrelated stuff is grouped here simply because buildbot needs it all. # See e.g. https://github.com/buildbot/buildbot/blob/master/master/buildbot/scripts/sample.cfg # for a simple hard-coded linear example of what buildbot needs set. # FIXME: find a more readable way to organize this # Since we need to process tags, disable merging for the moment # Later we can make this smarter and disable merging just changes # which are at tags, or enable merging just on builders that are # way too slow and don't mind missing a tag self['mergeRequests'] = False # PORT NUMBERS # It's hard to keep port numbers straight for multiple projects, # so let's assign each project a slot number, # and use 8010 + slotnum for the http port, # 9010 + slotnum for the slave port, etc. # FIXME: get slot from masterjson slot = 0 self.__http_port = 8010 + slot self['slavePortnum'] = 9010 + slot # SECRETS # Avoid checking secrets into git by keeping them in a json file. try: s = json.load(open(os.path.expanduser(secretsfile))) self.__auth = auth.BasicAuth([ (s["webuser"].encode('ascii', 'ignore'), s["webpass"].encode('ascii', 'ignore')) ]) # For the moment, all slaves have same password self.slavepass = s["slavepass"].encode('ascii', 'ignore') except: exit( "%s must be a json file containing webuser, webpass, and slavepass; ascii only, no commas in quotes" % secretsfile) # STATUS TARGETS self['status'] = [] authz_cfg = authz.Authz( # change any of these to True to enable; see the manual for more # options auth=self.__auth, gracefulShutdown=False, forceBuild='auth', forceAllBuilds=True, pingBuilder=True, stopBuild=True, stopAllBuilds=True, cancelPendingBuild=True, ) # Need order_console_by_time for git or hg or any vcs that doesn't have numbered changesets self['status'].append( html.WebStatus(http_port=self.__http_port, authz=authz_cfg, order_console_by_time=True)) self['status'].append( MailNotifier(fromaddr="*****@*****.**", mode=('problem'), sendToInterestedUsers=True, extraRecipients=['*****@*****.**'])) irc = words.IRC("irc.tchpc.tcd.ie", "buildbot", useColors=False, channels=[{ "channel": "#dri" }], notify_events={ 'exception': 1, 'successToFailure': 1, 'failureToSuccess': 1, }) self['status'].append(irc) # DB URL self['db'] = { # This specifies what database buildbot uses to store its state. # This default is ok for all but the largest installations. 'db_url': "sqlite:///state.sqlite", } # PROJECT IDENTITY # the 'title' string will appear at the top of this buildbot # installation's html.WebStatus home page (linked to the # 'titleURL') and is embedded in the title of the waterfall HTML page. # FIXME: get name and homepage from masterjson self['title'] = name self['titleURL'] = homepage # the 'buildbotURL' string should point to the location where the buildbot's # internal web server (usually the html.WebStatus page) is visible. This # typically uses the port number set in the Waterfall 'status' entry, but # with an externally-visible host name which the buildbot cannot figure out # without some help. #self['buildbotURL'] = "http://" + socket.gethostname() + ":%d/" % self.__http_port self['buildbotURL'] = "http://tracker.dri.ie/ci/" # SLAVES self._os2slaves = {} self['slaves'] = [] slaveconfigs = masterjson["slaves"] for slaveconfig in slaveconfigs: sname = slaveconfig["name"].encode('ascii', 'ignore') sos = slaveconfig["os"].encode('ascii', 'ignore') props = {'oneshot': False} if "oneshot" in slaveconfig: oneshot = slaveconfig["oneshot"].encode('ascii', 'ignore') if oneshot == "True": props['oneshot'] = True else: exit("oneshot property must be absent or True") # Restrict to a single build at a time because our buildshims # typically assume they have total control of machine, and use sudo apt-get, etc. with abandon. s = BuildSlave(sname, self.slavepass, max_builds=1, properties=props) self['slaves'].append(s) if sos not in self._os2slaves: self._os2slaves[sos] = [] self._os2slaves[sos].append(sname) # These will be built up over the course of one or more calls to addSimpleProject self['change_source'] = [] self['builders'] = [] self['schedulers'] = [] # Righty-o, wire 'em all up for project in masterjson["projects"]: self.addSimpleProject( project["name"].encode('ascii', 'ignore'), project["category"].encode('ascii', 'ignore'), project["repourl"].encode('ascii', 'ignore'), project["builders"])
# Nokia Corporation - initial contribution. # # Contributors: # # Description: # # from buildbot.status import html, mail, words web = html.WebStatus(http_port=8010) allBuildsEmail = mail.MailNotifier( fromaddr="*****@*****.**", extraRecipients=["*****@*****.**"], sendToInterestedUsers=False) breakageEmail = mail.MailNotifier(fromaddr="*****@*****.**", lookup=mail.Domain("webkit.org"), mode="failing") IRC = words.IRC( host="irc.freenode.net", nick="webkit-build", channels=["#webkit-build"], # announceAllBuilds=True ) def getStatusListeners(): return [web, allBuildsEmail, breakageEmail, IRC]
from buildbot.status import html, words from buildbot.status.web import authz, auth from config import users authz_cfg = authz.Authz( auth=auth.BasicAuth(users), gracefulShutdown=False, forceBuild='auth', forceAllBuilds='auth', pingBuilder='auth', stopBuild='auth', stopAllBuilds='auth', cancelPendingBuild='auth') www_status = html.WebStatus(http_port=8010, authz=authz_cfg, change_hook_dialects={'github': True}) irc_status = words.IRC(host="irc.freenode.net", nick="p3dbuildbot", channels=["#panda3d-devel"], notify_events={ 'exception': True, 'failureToSuccess': True, 'successToFailure': True}) # Fix the stupid github hook... I submitted a patch to buildbot for this. # This should be fixed in buildbot 0.8.11. from buildbot.status.web.hooks import github import change_hook github.getChanges = change_hook.getChanges github.process_change = change_hook.process_change
# Email notifier mn = MailNotifier(fromaddr="*****@*****.**", subject="Nim-Buildbot: %(builder)s requires attention.", mode=['change', 'problem', 'warnings', 'exception'], builders=None, sendToInterestedUsers=False, extraRecipients=buildbot_admin_emails) # IRC bot irc = words.IRC(host="irc.freenode.net", channels=[{ "channel": "#nimbuild" }], nick=irc_credentials['username'], password=irc_credentials['password'], useColors=False, notify_events={ 'finished': 1, 'failure': 1, 'exception': 1, }) # Github Status gs = GitHubStatus(token=github_token, repoOwner="nim-lang", repoName="Nim", startDescription='Build started.', endDescription='Build done.') c['status'] = [irc, gs]