Buildbot: build automatically when git commits are made

But don't package and upload them, that only happens nightly still.
There will be one build per set of commits that arrives within 120s
of each other.

The idea behind this is that it will help us more easily find which
commits break the build or tests.

Differential Revision: https://developer.blender.org/D8438
This commit is contained in:
2020-06-19 16:20:29 +02:00
parent f3436ff838
commit dcbd1347c9

View File

@@ -34,6 +34,8 @@ from buildbot.process.factory import BuildFactory
from buildbot.plugins import steps, util
from buildbot.config import BuilderConfig
from buildbot.schedulers import timed, forcesched
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.filter import ChangeFilter
from buildbot.changes.gitpoller import GitPoller
from buildbot.changes.svnpoller import SVNPoller
from buildbot.worker import Worker
@@ -81,8 +83,9 @@ c['protocols'] = {
################################################################################
# CHANGE SOURCES
c['change_source'] = GitPoller('git://git.blender.org/blender.git',
pollinterval=1200)
c['change_source'] = GitPoller(repourl='git://git.blender.org/blender.git',
pollinterval=120,
project='blender')
################################################################################
# CODEBASES
@@ -150,8 +153,7 @@ def schedule_force_build(name, branch):
name='project',
default='',
hide=True)),
],
properties=[]))
]))
def schedule_nightly_build(name, branch, hour, minute=0):
@@ -170,6 +172,23 @@ def schedule_nightly_build(name, branch, hour, minute=0):
minute=minute))
def schedule_change_build(name, branch):
"""
Creates scheduler for building on changes.
This will not package and upload the build.
"""
scheduler_name = f'change_{name} {branch}'
c['schedulers'].append(SingleBranchScheduler(
name=scheduler_name,
codebases={
'blender': {'repository': '',
'branch': branch}},
builderNames=[name],
treeStableTimer=120,
change_filter=ChangeFilter(project=['blender'], branch=branch),
properties={'skip_upload': True, 'skip_codesign': True}))
################################################################################
# BUILDERS
#
@@ -201,6 +220,7 @@ def add_builder(c, name, platforms, factory, branch='', hour=3, minute=0):
if branch != '':
schedule_nightly_build(builder_name, branch, hour, minute)
schedule_change_build(builder_name, branch)
schedule_force_build(builder_name, branch)
@@ -226,6 +246,9 @@ def git_step(branch=''):
# Generic builder.
def do_upload(step):
return not step.hasProperty('skip_upload')
@util.renderer
def script_command(props, script, id, branch):
# NOTE: On Windows never includes major version in the executable name,
@@ -236,7 +259,10 @@ def script_command(props, script, id, branch):
python_command = 'python3'
git_branch = branch or Interpolate('%(src:blender:branch)s')
args = [python_command, script, id, git_branch, '--codesign']
args = [python_command, script, id, git_branch]
if not props.hasProperty('skip_codesign'):
args += ['--codesign']
return args
@@ -269,19 +295,22 @@ def generic_builder(id, branch=''):
command=script_command.withArgs(pack_script, id, branch),
description='packaging',
descriptionDone='packaged',
haltOnFailure=True))
haltOnFailure=True,
doStepIf=do_upload))
f.addStep(FileUpload(name='upload',
workersrc='buildbot_upload.zip',
masterdest=filename,
maxsize=500 * 1024 * 1024,
workdir='install'))
workdir='install',
doStepIf=do_upload))
f.addStep(MasterShellCommand(name='unpack',
command=['python3.7',
unpack_script,
filename],
description='unpacking',
descriptionDone='unpacked'))
descriptionDone='unpacked',
doStepIf=do_upload))
return f