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.plugins import steps, util
from buildbot.config import BuilderConfig from buildbot.config import BuilderConfig
from buildbot.schedulers import timed, forcesched 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.gitpoller import GitPoller
from buildbot.changes.svnpoller import SVNPoller from buildbot.changes.svnpoller import SVNPoller
from buildbot.worker import Worker from buildbot.worker import Worker
@@ -81,8 +83,9 @@ c['protocols'] = {
################################################################################ ################################################################################
# CHANGE SOURCES # CHANGE SOURCES
c['change_source'] = GitPoller('git://git.blender.org/blender.git', c['change_source'] = GitPoller(repourl='git://git.blender.org/blender.git',
pollinterval=1200) pollinterval=120,
project='blender')
################################################################################ ################################################################################
# CODEBASES # CODEBASES
@@ -150,8 +153,7 @@ def schedule_force_build(name, branch):
name='project', name='project',
default='', default='',
hide=True)), hide=True)),
], ]))
properties=[]))
def schedule_nightly_build(name, branch, hour, minute=0): def schedule_nightly_build(name, branch, hour, minute=0):
@@ -170,6 +172,23 @@ def schedule_nightly_build(name, branch, hour, minute=0):
minute=minute)) 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 # BUILDERS
# #
@@ -201,6 +220,7 @@ def add_builder(c, name, platforms, factory, branch='', hour=3, minute=0):
if branch != '': if branch != '':
schedule_nightly_build(builder_name, branch, hour, minute) schedule_nightly_build(builder_name, branch, hour, minute)
schedule_change_build(builder_name, branch)
schedule_force_build(builder_name, branch) schedule_force_build(builder_name, branch)
@@ -226,6 +246,9 @@ def git_step(branch=''):
# Generic builder. # Generic builder.
def do_upload(step):
return not step.hasProperty('skip_upload')
@util.renderer @util.renderer
def script_command(props, script, id, branch): def script_command(props, script, id, branch):
# NOTE: On Windows never includes major version in the executable name, # 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' python_command = 'python3'
git_branch = branch or Interpolate('%(src:blender:branch)s') 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 return args
@@ -269,19 +295,22 @@ def generic_builder(id, branch=''):
command=script_command.withArgs(pack_script, id, branch), command=script_command.withArgs(pack_script, id, branch),
description='packaging', description='packaging',
descriptionDone='packaged', descriptionDone='packaged',
haltOnFailure=True)) haltOnFailure=True,
doStepIf=do_upload))
f.addStep(FileUpload(name='upload', f.addStep(FileUpload(name='upload',
workersrc='buildbot_upload.zip', workersrc='buildbot_upload.zip',
masterdest=filename, masterdest=filename,
maxsize=500 * 1024 * 1024, maxsize=500 * 1024 * 1024,
workdir='install')) workdir='install',
doStepIf=do_upload))
f.addStep(MasterShellCommand(name='unpack', f.addStep(MasterShellCommand(name='unpack',
command=['python3.7', command=['python3.7',
unpack_script, unpack_script,
filename], filename],
description='unpacking', description='unpacking',
descriptionDone='unpacked')) descriptionDone='unpacked',
doStepIf=do_upload))
return f return f