diff options
author | Kali Kaneko <kali@leap.se> | 2013-09-05 21:46:46 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-09-05 21:46:46 +0200 |
commit | 3eba8e3a67d947b4d5a0897b2964c3ec0d953a8b (patch) | |
tree | ed7044f9b0ec14c5392c622dbef536c15f2e6c97 |
initial commit
-rw-r--r-- | buildbot.tac | 31 | ||||
-rw-r--r-- | master.cfg | 365 |
2 files changed, 396 insertions, 0 deletions
diff --git a/buildbot.tac b/buildbot.tac new file mode 100644 index 0000000..9ea628f --- /dev/null +++ b/buildbot.tac @@ -0,0 +1,31 @@ +import os + +from twisted.application import service +from buildbot.master import BuildMaster + +basedir = '/home/buildmaster/buildmaster' +rotateLength = '10000000' +maxRotatedFiles = '10' +configfile = 'master.cfg' + +# Default umask for server +umask = None + +# if this is a relocatable tac file, get the directory containing the TAC +if basedir == '.': + import os.path + basedir = os.path.abspath(os.path.dirname(__file__)) + +# note: this line is matched against to check that this is a buildmaster +# directory; do not edit it. +application = service.Application('buildmaster') +from twisted.python.logfile import LogFile +from twisted.python.log import ILogObserver, FileLogObserver +logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength, + maxRotatedFiles=maxRotatedFiles) +application.setComponent(ILogObserver, FileLogObserver(logfile).emit) + +m = BuildMaster(basedir, configfile, umask) +m.setServiceParent(application) +m.log_rotation.rotateLength = rotateLength +m.log_rotation.maxRotatedFiles = maxRotatedFiles diff --git a/master.cfg b/master.cfg new file mode 100644 index 0000000..875ccce --- /dev/null +++ b/master.cfg @@ -0,0 +1,365 @@ +# -*- 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. + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. +c = BuildmasterConfig = {} + +####### BUILDSLAVES + +# The 'slaves' list defines the set of recognized buildslaves. Each element is +# a BuildSlave object, specifying a unique slave name and password. The same +# slave name and password must be configured on the slave. +from buildbot.buildslave import BuildSlave +c['slaves'] = [BuildSlave("linux-build-slave", "foobar"), +# BuildSlave("windows-build-slave", "foobar"), +# BuildSlave("mac-build-slave", "foobar") + ] +# 'slavePortnum' defines the TCP port to listen on for connections from slaves. +# This must match the value configured into the buildslaves (with their +# --master option) +c['slavePortnum'] = 9989 + +####### CHANGESOURCES + +# the 'change_source' setting tells the buildmaster how it should find out +# about source code changes. + +import subprocess + +def run_cmd(cmd, cwd=None): + p = subprocess.Popen(cmd.split(" "), stdout=subprocess.PIPE, cwd=cwd) + stdout = p.communicate()[0] + return stdout + +# to generate the list of remote branches we +# 1. create bare repositry +# 2. get the list of branches +# 3. delete the repository + + +#gitflow = [] + +#clone_cmd = "git clone --bare git://leap.se/leap_client tmp" +#run_cmd(clone_cmd) +#list_branch_cmd = "git branch --list feature/*" +#stdout = run_cmd(list_branch_cmd, "tmp") +#for line in stdout.split("\n"): +# if len(line.strip())> 0: +# gitflow.append(line.strip()) +#rm_cmd = "rm -rf tmp" +#run_cmd(rm_cmd) +#branches = ['develop'] + gitflow + +# XXX For NOW, only develop branches +branches = ['develop'] + +from buildbot.changes.gitpoller import GitPoller +from buildbot.changes import pb + +c['change_source'] = [] +c['change_source'].append(GitPoller( + 'git://leap.se/leap_client', + workdir="gitpoller-workdir", branches=branches, pollinterval=300)) + +#c['change_source'].append(pb.PBChangeSource( +# port=9999, user='laura', passwd='firewalk')) + +#git poll branch names to automatically build branches to watch. + +####### SCHEDULERS + +# Configure the Schedulers, which decide how to react to incoming changes. In this +# case, just kick off a 'runtests' build + +from buildbot.schedulers.basic import SingleBranchScheduler +from buildbot.schedulers.forcesched import ForceScheduler +from buildbot.schedulers.timed import Nightly +from buildbot.changes import filter + +c['schedulers'] = [] +c['schedulers'].append(ForceScheduler( + name="force", + builderNames=["linux-incremental", +# "windows-incremental", +# "mac-incremental" + ])) + +for branch in branches: + c['schedulers'].append(SingleBranchScheduler( + name=branch + "-checkin", + change_filter=filter.ChangeFilter(branch=branch), + treeStableTimer=60, + builderNames=["linux-incremental", + "client-linux-quick", +# "windows-incremental", +# "mac-incremental" + ])) + +c['schedulers'].append(Nightly( + name="develop-nightly", + branch="develop", + hour=4, + minute=23, + onlyIfChanged=True, + builderNames=["client-linux-quick", +# "windows-full", +# "mac-full" + ])) + +####### BUILDERS + +# The 'builders' list defines the Builders, which tell Buildbot how to perform a build: +# what steps, and which slaves can execute them. Note that any particular build will +# only take place on one slave. + +from buildbot.process.factory import BuildFactory +from buildbot.steps.source.git import Git +from buildbot.steps.shell import ShellCommand + +# XXX TODO lock down accepted commands + +class UploadCoverage(ShellCommand): + def start(self): + self.buildername = self.getProperty("buildername") + self.branch = self.getProperty("branch") + self.buildnumber = self.getProperty("buildnumber") + + cmd = """ssh -p 4422 buildmaster@lemur.leap.se mkdir -p buildmaster/public_html/coverage/%s/%s/ +scp -P 4422 -r docs/covhtml/ buildmaster@lemur.leap.se:buildmaster/public_html/coverage/%s/%s/%s/""" % ( +self.buildername, self.branch, +self.buildername, self.branch, self.buildnumber) + self.setCommand(cmd) + ShellCommand.start(self) + + def createSummary(self, log): + url = "http://lemur.leap.se:8010/coverage/%s/%s/%s/" % ( + self.buildername, self.branch, self.buildnumber) + self.addURL("coverage", url) + +# factories are responsible for creating new Build instances +#cp_script = ShellCommand(name='Copy script', +# description='copy script (need to push this XXX!)', +# #command=['cp', 'pkg/scripts/install_venv.py', 'pkg/']) +# command=['cp', '/home/buildslave/scripts/install_venv.py', 'pkg/']) + +#skip_pyside = ShellCommand(name='Skip pyside', +# description='workaround for skipping pyside', +# command=['sed', '-i', 's/PySide/#PySide/', 'pkg/requirements.pip']) + +#add_missing_dep = ShellCommand(name='Extra dep', +# description='workaround for missing deps XXX -- push', +# command=['sed', '-i', '$ a\oauth', 'pkg/requirements.pip']) + +#install_virt = ShellCommand(name='Installing Virtual Environment', +# env={'LEAP_VENV_SKIP_PYSIDE': '1'}, +# description='Installing Virtual Environment', +# command=['python', 'pkg/install_venv.py']) + +# XXX Workaround for long installs --- should add another builder +# that works inside a permanent virtualenv, using venvwrapper... +install_virt = ShellCommand(name='Installing Virtual Environment', + env={'LEAP_VENV_SKIP_PYSIDE': '1'}, + description='Installing Virtual Environment', + command=['cp', '-r', '/home/buildslave/venv/.venv', '.']) + +develop_mode = ShellCommand(name='run in develop mode', + description='yet another workaround for namespace package weirdness', + command=['pkg/tools/with_venv.sh', 'python', 'setup.py', 'develop']) + +install_leap = ShellCommand(name='install leap into virtualenv', + description='yet another workaround for namespace package weirdness', + command=['pkg/tools/with_venv.sh', 'python', 'setup.py', 'install']) + +make_resources = ShellCommand(name='compile qt resources', + description='generates locales and ui files', + command=['make']) + +run_tests = ShellCommand(name='Running Tests', description='Running tests', + command=['pkg/tools/with_venv.sh', './run_tests.sh', '--coverage']) +#run_tests = ShellCommand(name='Running Tests', description='Running tests', +# command=['pkg/tools/with_venv.sh', 'nosetests', +# 'src/leap', '--exclude-dir=src/leap/soledad/', +# '--exclude-dir=src/leap/common/']) + +# XXX will need to introduce xvfb-run again... +#run_tests = ShellCommand(name='Running Tests', description='Running tests', +# command=['pkg/tools/with_venv.sh', 'xvfb-run', 'nosetests', +# '--with-coverage', '--cover-package=leap-client', 'leap']) + +#run_mail_tests = ShellCommand(name='Running Mail Tests', description='Running mail tests', +# command=['pkg/tools/with_venv.sh', 'trial', '--coverage', +# 'leap.email.smtp.tests']) +#run_soledad_tests = ShellCommand(name='Running Soledad Tests', description='Running soledad tests', +# env={'LD_PRELOAD':'/usr/local/lib/libsqlite3.so'}, +# command=['pkg/tools/with_venv.sh', 'nose2', '-v', 'leap.soledad.tests']) + +run_tox = ShellCommand(name='Running tox', description='Running tox', + command=['pkg/tools/with_venv.sh', 'tox', '-v']) +run_pep8 = ShellCommand(name='Running pep8', description='Running pep8', + command=['pkg/tools/with_venv.sh', 'pep8', + '--ignore=E202,W602 --exclude=ui_*,*_rc.py,_version.py --repeat', + 'src/leap']) +run_coverage = ShellCommand(name='Running coverage', description='Running coverage', + command=['pkg/tools/with_venv.sh', 'coverage', 'html', + '-d', 'docs/covhtml', '-i', '--include=src/leap/*', + '--omit=src/leap/base/tests/*,src/leap/eip/tests/*,src/leap/gui/tests/*,/src/leap/util/tests/*'], + haltOnFailure=True) + +f1 = BuildFactory() +f1.addStep(Git(repourl='git://leap.se/leap_client', mode='incremental', branch='develop')) +#f1.addStep(cp_script) +#f1.addStep(skip_pyside) +f1.addStep(install_virt) +f1.addStep(run_tests) +#f1.addStep(run_mail_tests) +#f1.addStep(run_soledad_tests) +f1.addStep(run_tox) +f1.addStep(run_pep8) +f1.addStep(run_coverage) +f1.addStep(UploadCoverage(name='Uploading coverage', description='Uploading coverage')) + +def get_client_quick_builder(): + f = BuildFactory() + # aka "CLIENT LINUX QUICK" + f.addStep(Git(repourl='git://leap.se/leap_client', mode='full', branch='develop')) + #f.addStep(Git(repourl='git://github.com/kalikaneko/leap_client.git', mode='full', branch='ci-testing')) + #f.addStep(cp_script) + #f.addStep(skip_pyside) + #f.addStep(add_missing_dep) + f.addStep(install_virt) + f.addStep(make_resources) + #f.addStep(develop_mode) + #f.addStep(install_leap) + f.addStep(run_tests) + #f.addStep(run_mail_tests) + #f.addStep(run_soledad_tests) + + # no tox on quick builder + #f.addStep(run_tox) + + f.addStep(run_pep8) + #f.addStep(run_coverage) + f.addStep(UploadCoverage(name='Uploading coverage', description='Uploading coverage')) + b = {'name': "client-linux-quick", + 'slavename': "linux-build-slave", + 'builddir': "client_linux_quick", + 'factory': f, + } + return b + +# multiple buildslaves in a builder provide redundancy +# Difft platforms, OSes, versions, libraries should have dfft Builders +b1 = {'name': "linux-incremental", + 'slavename': "linux-build-slave", + 'builddir': "linux-incremental", + 'factory': f1, + } +#b2 = {'name': "windows-incremental", +# 'slavename': "windows-build-slave", +# 'builddir': "windows-incremental", +# 'factory': f1, +# } +#b3 = {'name': "mac-incremental", +# 'slavename': "mac-build-slave", +# 'builddir': "mac-incremental", +# 'factory': f1, +# } +#b4 = {'name': "linux-full", +# 'slavename': "linux-build-slave", +# 'builddir': "linux-full", +# 'factory': f2, +# } +#b5 = {'name': "client-linux-quick", +# 'slavename': "linux-build-slave", +# 'builddir': "client_linux_quick", +# 'factory': get_client_quick_builder(), +# } +#b5 = {'name': "windows-full", +# 'slavename': "windows-build-slave", +# 'builddir': "windows-full", +# 'factory': f2, +# } +#b6 = {'name': "mac-full", +# 'slavename': "mac-build-slave", +# 'builddir': "mac-full", +# 'factory': f2, +# } + +#c['builders'] = [b1, b2, b3, b4, b5, b6] +# b5 = get_client_quick_builder()] +c['builders'] = [b1, get_client_quick_builder()] + +####### 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. + +c['status'] = [] + +from buildbot.status import html +from buildbot.status.web import authz, auth + +authz_cfg=authz.Authz( + # change any of these to True to enable; see the manual for more + # options + auth=auth.BasicAuth([("foobar","foobar")]), + gracefulShutdown = False, + forceBuild = 'auth', # use this to test your slave once it is set up + forceAllBuilds = False, + pingBuilder = False, + stopBuild = False, + stopAllBuilds = False, + cancelPendingBuild = False, +) +c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) + +# Our dear polkabot! .... + +from buildbot.status import words + +BBOT_NICK = "polkabot" +BBOT_CHANNELS = ["#borogoves"] +c['status'].append(words.IRC( + host="irc.indymedia.org", + nick=BBOT_NICK, + channels=BBOT_CHANNELS, + allowForce=True, + notify_events={ +# 'started': 1, +# 'finished': 1, +# 'failure': 1, + } +)) +#c['status'].append(words.IRC(host="chat.freenode.net", nick="leap-buildbot", +# channels=["#leap-dev"])) + + +####### 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. + +c['title'] = "LEAP" +c['titleURL'] = "https://leap.se" + +# 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. + +c['buildbotURL'] = "http://lemur.leap.se:8010/" + +####### DB URL + +c['db'] = { + # This specifies what database buildbot uses to store its state. You can leave + # this at its default for all but the largest installations. + 'db_url' : "sqlite:///state.sqlite", +} |