# -*- python -*-
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
import os, os.path, re
from buildbot.scheduler import Scheduler
from buildbot.process import factory
from buildbot.steps import source, shell
from buildbot.status.html import WebStatus
from buildbot.scheduler import AnyBranchScheduler
#from buildbot.twcompat import implements
from buildbot.scheduler import Try_Userpass
from buildbot.scheduler import Nightly
from buildbot.changes.svnpoller import SVNPoller, split_file_branches
from buildbot.buildslave import BuildSlave
#import TigrisMailSource
import SVNMailNotifier
from Feeder import WebStatusWithFeeds
import private
REPO="http://svn.apache.org/repos/asf/subversion/"
s = factory.s
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
# slaves
c['slaves'] = [BuildSlave("fc1-gcc3.3.2-ia32", private.slavePwd),
BuildSlave("osx10.4-gcc4.0.1-ia32", private.slavePwd),
BuildSlave("xp-vs2003-ia32", private.slavePwd),
BuildSlave("dlr-fc3", private.slavePwd),
BuildSlave("eh-debsarge1", private.slavePwd),
BuildSlave("x64-ubuntu", private.hwrightPwd),
BuildSlave("x64-centos", private.wandPwd),
]
# sources
c['change_source'] = SVNPoller(REPO,
split_file=split_file_branches,
svnbin=private.svnbin,
pollinterval=300)
excludes = ["COMMITTERS", "STATUS", "CHANGES", "README", "INSTALL", "COPYING", "HACKING", "TRANSLATING", "BUGS", "www", "notes", "packages", "subversion/LICENSE", "subversion/po", "doc", "contrib", "tools", "dist.sh"]
# function checks if this revision is interesting enough to trigger the builds.
def isImportant(change):
if not excludes:
return True
for file in change.files:
triggerBuild = True
for pattern in excludes:
match = re.match(pattern, file)
if match:
triggerBuild = False
break
if triggerBuild:
return True
# schedulers
bs1 = AnyBranchScheduler("main",
[None, "branches/1.3.x", "branches/1.4.x", "branches/1.5.x",
"branches/1.6.x"],
5*60, ["x86-macosx-gnu shared",
"debian-x86_64-32 shared gcc",
"x64-ubuntu gcc",
"x64-centos gcc",
],
fileIsImportant=isImportant)
ps1 = Nightly('daily-2pm-cet', ['x86-macosx-gnu shared daily ra_serf'], hour=14, minute=0)
ts = Try_Userpass("try", ["x86-macosx-gnu shared", "debian-x86_64-32 shared gcc"],
port=private.tryPort, userpass=[(private.tryUser,private.tryPwd)] )
c['schedulers'] = [bs1, ps1, ts]
# steps and builders
# define default set of steps, all under masters control.
defSteps = [shell.ShellCommand(name="Cleanup", command=["../svnclean.sh"], timeout=3600),
source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["../svnbuild.sh"], logfiles={"configlog": "config.log"}, timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_neon", command=["../svncheck.sh", "fsfs", "ra_neon"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
defFact = factory.BuildFactory(defSteps)
# define Windows custom steps
winSteps = [source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["..\svnbuild.bat"], timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_local", command=["..\svncheck.bat","fsfs","ra_local"], timeout=3600, flunkOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_dav", command=["..\svncheck.bat","fsfs","ra_dav"], timeout=3600, flunkOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_svn", command=["..\svncheck.bat","fsfs","ra_svn"], timeout=3600, flunkOnFailure=True),
shell.ShellCommand(name="Cleanup", command=["..\svnclean.bat"], timeout=3600),
]
winFact = factory.BuildFactory(winSteps)
# define Windows 6 way steps
win6wSteps = [source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Cleanup", command=["..\svnclean.bat"], timeout=3600),
shell.ShellCommand(name="Build", command=["..\svnbuild.bat", "%(branch)"], timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_local", command=["..\svncheck.bat","fsfs","ra_local"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
win6wFact = factory.BuildFactory(win6wSteps)
# define set of steps for eh-x84_64-32, clean step comes first.
ehSteps = [shell.ShellCommand(name="Cleanup", command=["../svnclean.sh"], workdir='', timeout=3600),
source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["../svnbuild.sh"], logfiles={"configlog": "config.log"}, timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_svn", command=["../svncheck.sh","fsfs","ra_svn"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
ehFact = factory.BuildFactory(ehSteps)
# nightly build ra_serf
serfSteps = [shell.ShellCommand(name="Cleanup", command=["../svnclean.sh"], timeout=3600),
source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["../svnbuild.sh"], logfiles={"configlog": "config.log"}, timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_serf", command=["../svncheck.sh", "fsfs", "ra_serf"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
serfFact = factory.BuildFactory(serfSteps)
# define set of steps for x64-ubuntu, clean step comes first.
x64ubSteps = [shell.ShellCommand(name="Cleanup", command=["../svnclean.sh"], workdir='', timeout=3600),
source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["../svnbuild.sh"], logfiles={"configlog": "config.log"}, timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_local", command=["../svncheck.sh","fsfs","ra_local"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=False),
shell.ShellCommand(name="Test bindings", command=["../svncheck-bindings.sh","fsfs","ra_local"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
x64ubFact = factory.BuildFactory(x64ubSteps)
x64coSteps = [shell.ShellCommand(name="Cleanup", command=["../svnclean.sh"], timeout=3600),
source.SVN(baseURL=REPO,defaultBranch='trunk', timeout=3600),
shell.ShellCommand(name="Build", command=["../svnbuild.sh"], logfiles={"configlog": "config.log"}, timeout=3600, haltOnFailure=True),
shell.ShellCommand(name="Test fsfs+ra_local", command=["../svncheck.sh", "fsfs", "ra_neon"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
shell.ShellCommand(name="Test bindings", command=["../svncheck-bindings.sh","fsfs","ra_neon"], logfiles={"testlog": "tests.log"}, timeout=3600, flunkOnFailure=True),
]
x64coFact = factory.BuildFactory(x64coSteps)
c['builders'] = [
{'name': "x86-macosx-gnu shared",
'slavename': "osx10.4-gcc4.0.1-ia32",
'builddir': "osx10.4-gcc4.0.1-ia32",
'factory': defFact,
'category': "prod",
},
{'name': "debian-x86_64-32 shared gcc",
'slavename': "eh-debsarge1",
'builddir': "eh-debsarge1",
'factory': ehFact,
'category': "prod",
},
{'name': "x86-macosx-gnu shared daily ra_serf",
'slavename': "osx10.4-gcc4.0.1-ia32",
'builddir': "osx10.4-gcc4.0.1-ia32-serf",
'factory': serfFact,
'category': "prod",
},
{'name': "x64-ubuntu gcc",
'slavename': "x64-ubuntu",
'builddir': "x64-ubuntu",
'factory': x64ubFact,
'category': "prod",
},
{'name': "x64-centos gcc",
'slavename': "x64-centos",
'builddir': "x64-centos",
'factory': x64coFact,
'category': "prod",
},
]
# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)
c['slavePortnum'] = private.slavePortnum
# show webpage
c['status'] = []
c['status'].append(WebStatusWithFeeds(http_port="tcp:"+str(private.htmlPort)+":interface=127.0.0.1", allowForce=True))
# send emails
from buildbot.status import mail
mailbody = 'Full details are available at: \n%(buildurl)s\n\n'\
'Author list: %(blamelist)s\n\n'\
'Build Slave: %(slave)s\n\n\n'\
'Subversion Buildbot\n'\
'%(buildboturl)s\n\n\n'\
'Last 100 lines of the build log (step: %(laststep)s ):\n\n %(lastlog)s'
c['status'].append(SVNMailNotifier.SVNMailNotifier(
fromaddr="buildbot@mobsol.be",
extraRecipients=["notifications@subversion.apache.org"],
sendToInterestedUsers=False,
subject="svn %(branch)s r%(revision)s: %(result)s (%(builder)s)",
body=mailbody,
replytoaddr="dev@subversion.apache.org",
categories=["prod"],
relayhost=private.smtp))
# from buildbot.status import words
# c['status'].append(words.IRC(host="irc.example.com", nick="bb",
# channels=["#example"]))
# 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 telnet 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.
# from buildbot.master import Manhole
#c['manhole'] = Manhole(9999, "admin", "password")
# 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['projectName'] = "Subversion"
c['projectURL'] = "http://subversion.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.
c['buildbotURL'] = "http://crest.ics.uci.edu/buildbot/"