blob: d7d227ee6a5be280db9b5e1dcb031086959adfd0 [file] [log] [blame]
#!/usr/bin/python
# -*- python -*-
# ex: set syntax=python:
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').
# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
# Absolute or relative path to buildbot per-project configureations.
# For local Buildbot installation it is convenient to use the same directory
# for main master.cfg and projects .conf files
FP = './'
c = BuildmasterConfig = {}
####### BUILDSLAVES
# import the passwords
import private
reload(private)
# c['db_url'] = private.mysqlConnection
c['db'] = {
'db_url' : "sqlite:///state.sqlite",
}
# the 'slaves' list defines the set of allowable buildslaves. Each element is
# a tuple of bot-name and bot-password. These correspond to values given to
# the buildslave's mktap invocation.
from buildbot.buildslave import BuildSlave
c['slaves'] = []
c['slaves'].extend([
# NOTE:
# these slave definitions have to at least contain the
# same ones as the ones on the ci.apache.org Buildbot's
# master.cfg
# used slaves
BuildSlave(
'cordova-osx-slave',
private.cordovaOSXSlavePwd,
missing_timeout = 300,
max_builds = 1
),
BuildSlave(
'cordova-windows-slave',
private.cordovaWindowsSlavePwd,
missing_timeout = 300,
max_builds = 1
),
])
# to limit to two concurrent builds on a slave, use
# c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)]
# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)
c['slavePortnum'] = 9889
####### CHANGESOURCES
# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.
from buildbot.changes.pb import PBChangeSource
c['change_source'] = PBChangeSource(
port = 9999,
user = private.pbcsUser,
passwd = private.pbcsPwd
)
# from buildbot.changes.svnpoller import SVNPoller)
# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
#pb = ConfigurationSet([
# (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)),
# ])
# then you could use the following buildmaster Change Source to subscribe to
# the FreshCVS daemon and be notified on every commit:
#
#from buildbot.changes.freshcvs import FreshCVSSource
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar")
#c['change_source'] = fc_source
# or, use a PBChangeSource, and then have your repository's commit script run
# 'buildbot sendchange', or use contrib/svn_buildbot.py, or
# contrib/arch_buildbot.py :
#
#from buildbot.changes.pb import PBChangeSource
#c['change_source'] = PBChangeSource()
####### GLOBAL EXCLUDES LIST - DO NOT TRIGGER BUILDS ON THESE FILES
import re
masterExcludes = ['STATUS' , 'README' , 'CHANGES' , 'INSTALL']
def isGlobalImportant(change):
if not masterExcludes:
return True
for file in change.files:
triggerBuild = True
for pattern in masterExcludes:
match = re.match(pattern, file)
if match:
triggerBuild = False
break
if triggerBuild:
return True
## NOTES
#
# add 'fileIsImportant = isGlobalImportant' to any project scheduler(s)
# that you want to apply this global list to.
#
# Projects can individually extend this global default :
#
# Place something like this in the projects/$project.conf file:
#
# $projectExcludes = [masterExcludes , "exclude.me" , "andme.too" , "etc..."]
#
# def isProjectimportant
# if not $projectExcludes:
# return True
#
# for file in change.files:
# triggerBuild = True
# for pattern in $projectExcludes:
# match = re.match(pattern, file)
# if match:
# triggerBuild = False
# break
# if triggerBuild:
# return True
#
##
# Then add 'fileisImportant = is$Projectimportant' to the scheduler.
# (replace $project in all above with actual project name!)
##
####### SCHEDULERS
## configure the Schedulers
from buildbot.scheduler import AnyBranchScheduler, Periodic, Scheduler, Nightly, Dependent
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.changes import filter
c['schedulers'] = []
# append project schedulers in projects/$project.conf
####### BUILDERS
# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
# name (required): the name used to describe this bilder
# slavename (required): which slave to use, must appear in c['bots']
# builddir (required): which subdirectory to run the builder in
# factory (required): a BuildFactory to define how the build is run
# periodicBuildTime (optional): if set, force a build every N seconds
# buildbot/process/factory.py provides several BuildFactory classes you can
# start with, which implement build processes for common targets (GNU
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the
# base class, and is configured with a series of BuildSteps. When the build
# is run, the appropriate buildslave is told to execute each Step in turn.
# the first BuildStep is typically responsible for obtaining a copy of the
# sources. There are source-obtaining Steps in buildbot/steps/source.py for
# CVS, SVN, and others.
# cvsroot = ":pserver:anonymous@cvs.sourceforge.net:/cvsroot/buildbot"
# cvsmodule = "buildbot"
from buildbot.process.properties import Interpolate
from buildbot.process import factory
from buildbot.steps.source.git import Git
from buildbot.steps.source.svn import SVN
from buildbot.steps.shell import Compile
from buildbot.steps.python_twisted import Trial
# append project builders in projects/$project.conf
c['builders'] = []
####### STATUS TARGETS
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
import json
with open(FP + 'cordova-config.json') as f:
json_config = json.load(f)
c['status'] = []
from buildbot.status import html
from buildbot.status.web import authz, auth
from buildbot.status.mail import MailNotifier
from buildbot.status import words
# change any of these to True to enable, and to 'auth' to
# enable when authenticated; see the manual for more options
authz_cfg = authz.Authz(
auth = auth.BasicAuth([(private.webAuthUser, private.webAuthPwd)]),
gracefulShutdown = False,
forceBuild = True,
forceAllBuilds = 'auth',
pingBuilder = False,
stopBuild = 'auth',
stopAllBuilds = 'auth',
cancelPendingBuild = 'auth',
)
mail_from = str(json_config['mail']['from'])
mail_to = []
for mt in json_config['mail']['to']:
mail_to.append(str(mt))
mail_pw = str(json_config['mail']['password'])
mn1 = MailNotifier(
fromaddr = mail_from,
sendToInterestedUsers = False,
mode = ('change', 'failing', 'warnings'),
extraRecipients = mail_to,
relayhost = 'smtp.gmail.com',
smtpPort = 587,
useTls = True,
smtpUser = mail_from,
smtpPassword = mail_pw,
)
c['status'].append(mn1)
c['status'].append(html.WebStatus(
http_port = 8010,
authz = authz_cfg,
change_hook_dialects = {
'github': {
'secret': private.githubSecret
}
},
change_hook_auth = ['file:github.passwd'],
))
# Include any global imports here that more than one project needs.
from buildbot.steps.master import MasterShellCommand
from buildbot.steps.transfer import FileUpload
from buildbot.steps.transfer import FileDownload
from buildbot.steps.transfer import DirectoryUpload
from buildbot.steps.shell import ShellCommand, SetProperty
from buildbot.steps.shell import Configure
from buildbot.steps.shell import Test
from buildbot.steps.python import PyFlakes
from buildbot.process.buildstep import BuildStep
from buildbot.process.properties import WithProperties
from buildbot import locks
# import the rat report fileupload class
# from rat_report_upload import rat_report_upload
# Ensure that projects include is below all definition imports.
execfile(FP + 'projects.conf', globals(), locals())
# Data Lifetime - how long to keep old build logs and status around.
c['changeHorizon'] = 200
c['buildHorizon'] = 100
c['eventHorizon'] = 50
c['logHorizon'] = 40
c['buildCacheSize'] = 50 # Not sure about value of this one, should be ok though.
c['changeCacheSize'] = 10000
####### DEBUGGING OPTIONS
# if you set 'debugPassword', then you can connect to the buildmaster with
# the diagnostic tool in contrib/debugclient.py . From this tool, you can
# manually force builds and inject changes, which may be useful for testing
# your buildmaster without actually commiting changes to your repository (or
# before you have a functioning 'sources' set up). The debug tool uses the
# same port number as the slaves do: 'slavePortnum'.
#c['debugPassword'] = "debugpassword"
# if you set 'manhole', you can ssh into the buildmaster and get an
# interactive python shell, which may be useful for debugging buildbot
# internals. It is probably only useful for buildbot developers. You can also
# use an authorized_keys file, or plain telnet.
#from buildbot import manhole
#c['manhole'] = manhole.PasswordManhole("tcp:9999:interface=127.0.0.1",
# "admin", "password")
####### PROJECT IDENTITY
# the 'projectName' string will be used to describe the project that this
# buildbot is working on. For example, it is used as the title of the
# waterfall HTML page. The 'projectURL' string will be used to provide a link
# from buildbot HTML pages to your project's home page.
c['title'] = 'Cordova Testing'
c['titleURL'] = 'http://cordova.apache.org'
# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server (usually the html.Waterfall 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.
mail_serverURL = str(json_config['mail']['serverURL'])
c['buildbotURL'] = mail_serverURL