From dcbd1347c996a84d17b64568133fec764408f8c0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Jun 2020 16:20:29 +0200 Subject: [PATCH] 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 --- master.cfg | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/master.cfg b/master.cfg index c5a2fef..2c7b103 100644 --- a/master.cfg +++ b/master.cfg @@ -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