319 lines
10 KiB
Python
319 lines
10 KiB
Python
# -*- python -*-
|
|
# ex: set syntax=python:
|
|
|
|
# <pep8 compliant>
|
|
|
|
# List of the branches being built automatically overnight
|
|
NIGHT_SCHEDULE_BRANCHES = ["master"]
|
|
|
|
# Dictionary that the buildmaster pays attention to.
|
|
c = BuildmasterConfig = {}
|
|
|
|
# BUILD WORKERS
|
|
#
|
|
# We load the slaves and their passwords from a separator file, so we can have
|
|
# this one in SVN.
|
|
|
|
from buildbot.worker import Worker
|
|
import master_private
|
|
|
|
c['workers'] = []
|
|
for slave in master_private.slaves:
|
|
c['workers'].append(Worker(slave['name'], slave['password']))
|
|
|
|
# TCP port through which slaves connect
|
|
c['protocols'] = {
|
|
"pb": {
|
|
"port": "tcp:{}".format(9989)
|
|
}
|
|
}
|
|
# CHANGE SOURCES
|
|
|
|
from buildbot.changes.svnpoller import SVNPoller
|
|
from buildbot.changes.gitpoller import GitPoller
|
|
|
|
c['change_source'] = GitPoller('git://git.blender.org/blender.git',
|
|
pollinterval=1200)
|
|
|
|
# CODEBASES
|
|
#
|
|
# Allow to control separately things like branches for each repo and submodules.
|
|
|
|
all_repositories = {
|
|
r'git://git.blender.org/blender.git': 'blender',
|
|
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
|
|
}
|
|
|
|
|
|
def codebaseGenerator(chdict):
|
|
return all_repositories[chdict['repository']]
|
|
|
|
|
|
c['codebaseGenerator'] = codebaseGenerator
|
|
|
|
|
|
# SCHEDULERS
|
|
#
|
|
# Decide how to react to incoming changes.
|
|
|
|
from buildbot.schedulers import timed, forcesched
|
|
|
|
c['schedulers'] = []
|
|
|
|
|
|
def schedule_force_build(name):
|
|
"""
|
|
Makes it possible to have "Force Build" for the given builder.
|
|
Makes sure only reasonabel subset of properties are exposed.
|
|
"""
|
|
c['schedulers'].append(forcesched.ForceScheduler(
|
|
name='force_' + name,
|
|
buttonName="Force Build",
|
|
builderNames=[name],
|
|
codebases=[forcesched.CodebaseParameter(
|
|
codebase="blender",
|
|
branch=forcesched.StringParameter(
|
|
name="branch",
|
|
label="Branch:",
|
|
default="master",
|
|
regex=r'^[a-zA-Z0-9][A-Za-z0-9_-]*$'),
|
|
# Hide revision. We don't want to allow anyone to overwrite the
|
|
# master build with an older version. Could be added back once we
|
|
# have authentication.
|
|
revision=forcesched.FixedParameter(
|
|
name="revision",
|
|
default="",
|
|
hide=True),
|
|
repository=forcesched.FixedParameter(
|
|
name="repository",
|
|
default="",
|
|
hide=True),
|
|
project=forcesched.FixedParameter(
|
|
name="project",
|
|
default="",
|
|
hide=True)),
|
|
],
|
|
properties=[]))
|
|
|
|
|
|
def schedule_nightly_build(name, hour, minute=0):
|
|
"""
|
|
Creates scheduler for nightly builds for a given builder.
|
|
"""
|
|
for current_branch in NIGHT_SCHEDULE_BRANCHES:
|
|
scheduler_name = "nightly_" + name
|
|
if current_branch:
|
|
scheduler_name += ' ' + current_branch
|
|
c['schedulers'].append(timed.Nightly(
|
|
name=scheduler_name,
|
|
codebases={
|
|
"blender": {"repository": "",
|
|
"branch": current_branch}},
|
|
branch=current_branch,
|
|
builderNames=[name],
|
|
hour=hour,
|
|
minute=minute))
|
|
|
|
|
|
# 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.config import BuilderConfig
|
|
from buildbot.plugins import steps, util
|
|
from buildbot.process.factory import BuildFactory
|
|
from buildbot.process.properties import Interpolate
|
|
from buildbot.steps.shell import ShellCommand
|
|
from buildbot.steps.shell import Compile
|
|
from buildbot.steps.shell import Test
|
|
from buildbot.steps.transfer import FileUpload
|
|
from buildbot.steps.master import MasterShellCommand
|
|
|
|
# add builder utility
|
|
|
|
c['builders'] = []
|
|
buildernames = []
|
|
|
|
|
|
def add_builder(c, name, factory, branch='',
|
|
rsync=False, hour=3, minute=0):
|
|
workernames = []
|
|
|
|
for slave in master_private.slaves:
|
|
if name in slave['builders']:
|
|
workernames.append(slave['name'])
|
|
|
|
if workernames:
|
|
f = factory(name, branch, rsync)
|
|
c['builders'].append(BuilderConfig(name=name,
|
|
workernames=workernames,
|
|
factory=f,
|
|
tags=['blender']))
|
|
buildernames.append(name)
|
|
|
|
schedule_nightly_build(name, hour, minute)
|
|
schedule_force_build(name)
|
|
|
|
|
|
# common steps
|
|
|
|
def git_step(branch=''):
|
|
if branch:
|
|
return steps.Git(name='blender.git',
|
|
repourl='git://git.blender.org/blender.git',
|
|
mode='incremental',
|
|
branch=branch,
|
|
codebase='blender',
|
|
workdir='blender.git',
|
|
submodules=True)
|
|
else:
|
|
return steps.Git(name='blender.git',
|
|
repourl='git://git.blender.org/blender.git',
|
|
mode='incremental',
|
|
codebase='blender',
|
|
workdir='blender.git',
|
|
submodules=True)
|
|
|
|
|
|
def rsync_step(python_command, id, branch, rsync_script):
|
|
return ShellCommand(name='rsync',
|
|
command=[python_command, rsync_script, id, branch],
|
|
description='uploading',
|
|
descriptionDone='uploaded',
|
|
workdir='install')
|
|
|
|
|
|
# generic builder
|
|
|
|
def generic_builder(id, branch='', rsync=False):
|
|
filename = 'uploaded/buildbot_upload_' + id + '.zip'
|
|
update_script = '../blender.git/build_files/buildbot/slave_update.py'
|
|
compile_script = '../blender.git/build_files/buildbot/slave_compile.py'
|
|
test_script = '../blender.git/build_files/buildbot/slave_test.py'
|
|
pack_script = '../blender.git/build_files/buildbot/slave_pack.py'
|
|
rsync_script = '../blender.git/build_files/buildbot/slave_rsync.py'
|
|
unpack_script = 'master_unpack.py'
|
|
|
|
f = BuildFactory()
|
|
if id.startswith('win'):
|
|
python_command = 'python'
|
|
else:
|
|
python_command = 'python3'
|
|
|
|
f.addStep(git_step(branch))
|
|
|
|
git_branch = branch or Interpolate('%(src:blender:branch)s')
|
|
|
|
f.addStep(ShellCommand(
|
|
name='submodules and libraries update',
|
|
command=[python_command, update_script, id, git_branch],
|
|
description='updating',
|
|
descriptionDone='updated'))
|
|
|
|
f.addStep(Compile(
|
|
command=[python_command, compile_script, id, git_branch],
|
|
timeout=3600))
|
|
f.addStep(Test(
|
|
command=[python_command, test_script, id, git_branch]))
|
|
f.addStep(ShellCommand(
|
|
name='package',
|
|
command=[python_command, pack_script, id, git_branch],
|
|
description='packaging',
|
|
descriptionDone='packaged'))
|
|
|
|
if rsync:
|
|
f.addStep(rsync_step(python_command, id, git_branch, rsync_script))
|
|
else:
|
|
f.addStep(FileUpload(name='upload',
|
|
workersrc='buildbot_upload.zip',
|
|
masterdest=filename,
|
|
maxsize=180 * 1024 * 1024,
|
|
workdir='install'))
|
|
f.addStep(MasterShellCommand(name='unpack',
|
|
command=['python3.6',
|
|
unpack_script,
|
|
filename],
|
|
description='unpacking',
|
|
descriptionDone='unpacked'))
|
|
return f
|
|
|
|
|
|
# Builders
|
|
|
|
add_builder(c, 'mac_x86_64_10_9_cmake', generic_builder, hour=1)
|
|
add_builder(c, 'linux_glibc217_x86_64_cmake', generic_builder, hour=1)
|
|
# NOTE: Visual Studio 2017 (vc15) is using libraries folder from
|
|
# Visual Studio 2015 (vc14)
|
|
add_builder(c, 'win64_cmake_vs2017', generic_builder, hour=1)
|
|
|
|
# HORIZONS
|
|
from datetime import timedelta
|
|
|
|
c['changeHorizon'] = 300
|
|
|
|
# Configure a janitor which will delete all logs older than one month,
|
|
# and will run on sundays at noon.
|
|
c['configurators'] = [util.JanitorConfigurator(
|
|
logHorizon=timedelta(weeks=4),
|
|
hour=12,
|
|
dayOfWeek=6)]
|
|
|
|
|
|
# WWW
|
|
c['www'] = dict(port=8010,
|
|
plugins={'console_view': {},
|
|
'grid_view': {},
|
|
'waterfall_view': {}})
|
|
|
|
# Access
|
|
from buildbot.www.authz.roles import RolesFromOwner
|
|
from buildbot.www.authz.roles import RolesFromBase
|
|
|
|
class StrangerRoles(RolesFromBase):
|
|
def getRolesFromUser(self, userDetails):
|
|
return ['stranger']
|
|
|
|
|
|
authz = util.Authz(
|
|
stringsMatcher=util.fnmatchStrMatcher, # simple matcher with '*' glob character
|
|
# stringsMatcher = util.reStrMatcher, # if you prefer regular expressions
|
|
allowRules=[
|
|
# admins can do anything,
|
|
# defaultDeny=False: if user does not have the admin role, we continue parsing rules
|
|
util.AnyEndpointMatcher(role="admins", defaultDeny=False),
|
|
|
|
# Defaulting old config, everyone can stop build.
|
|
util.StopBuildEndpointMatcher(role="stranger"),
|
|
util.ForceBuildEndpointMatcher(role="stranger"),
|
|
util.RebuildBuildEndpointMatcher(role="stranger"),
|
|
util.EnableSchedulerEndpointMatcher(role="admins"),
|
|
|
|
# if future Buildbot implement new control, we are safe with this last rule
|
|
# NOTE: This prevents us from cancelling queue, so disabled for now.
|
|
# util.AnyControlEndpointMatcher(role="admins")
|
|
],
|
|
roleMatchers=[
|
|
RolesFromOwner(role="owner"),
|
|
StrangerRoles(),
|
|
])
|
|
c['www']['authz'] = authz
|
|
|
|
# PROJECT IDENTITY
|
|
c['projectName'] = "Blender"
|
|
c['projectURL'] = "https://www.blender.org"
|
|
|
|
# Buildbot information
|
|
c['buildbotURL'] = "https://builder.blender.org/admin/"
|
|
c['buildbotNetUsageData'] = 'basic'
|
|
|
|
# Various
|
|
c['db_url'] = "sqlite:///state.sqlite"
|
|
|
|
c['title'] = "Blender"
|
|
c['titleURL'] = "https://builder.blender.org/"
|
|
|
|
# Disable sending of 'buildbotNetUsageData' for now, to improve startup time.
|
|
c['buildbotNetUsageData'] = None
|