def setupSchedulers(self, _schedulers, spawner_name, try_name, deploy_name, importantManager, codebases, dep_properties): # branch filtering is already made by the changesource _schedulers.append( schedulers.AnyBranchScheduler( name=spawner_name, builderNames=[spawner_name], change_filter=util.GerritChangeFilter( project=self.name, eventtype_re="ref-updated"), onlyImportant=True, fileIsImportant=importantManager.fileIsImportant, codebases=codebases, )) _schedulers.append( schedulers.AnyBranchScheduler( name=try_name, builderNames=[try_name], change_filter=util.GerritChangeFilter( project=self.name, eventtype="patchset-created"), onlyImportant=True, fileIsImportant=importantManager.fileIsImportant, codebases=codebases, )) _schedulers.append( schedulers.ForceScheduler( name="force" + spawner_name, builderNames=[spawner_name], codebases=self.createCodebaseParams(codebases))) _schedulers.append( schedulers.ForceScheduler( name=deploy_name, builderNames=[deploy_name], codebases=self.createCodebaseParamsForDeploy(codebases), properties=dep_properties))
def setupSchedulers(self, _schedulers, spawner_name, try_name, deploy_name, importantManager, codebases, dep_properties): _schedulers.append( schedulers.AnyBranchScheduler( name=spawner_name, builderNames=[spawner_name], change_filter=self.getPushChangeFilter(), onlyImportant=True, fileIsImportant=importantManager.fileIsImportant, codebases=codebases, )) if self.supportsTry: _schedulers.append( schedulers.AnyBranchScheduler( name=try_name, builderNames=[try_name], change_filter=self.getTryChangeFilter(), onlyImportant=True, fileIsImportant=importantManager.fileIsImportant, codebases=codebases, )) _schedulers.append( schedulers.ForceScheduler( name="force" + spawner_name, builderNames=[spawner_name], codebases=self.createCodebaseParams(codebases))) _schedulers.append( schedulers.ForceScheduler( name=deploy_name, builderNames=[deploy_name], codebases=self.createCodebaseParamsForDeploy(codebases), properties=dep_properties))
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import schedulers from buildbot.plugins import util lock = util.MasterLock("lock") c['schedulers'] = [ schedulers.AnyBranchScheduler( name="sched", builderNames=["testy", "testy2", "testy3"]), ] f = BuildFactory() lockstep = LockedStep(locks=[lock.access('exclusive')]) f.addStep(lockstep) # assert lockstep._factory.buildStep() == lockstep._factory.buildStep() c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f), BuilderConfig(name="testy2", workernames=["local1"], factory=f), BuilderConfig(name="testy3", workernames=["local1"], factory=f)] return c
def setupTriggerConfiguration(triggeredFactory, nextBuild=None): c = {} c['schedulers'] = [ schedulers.Triggerable(name="trigsched", builderNames=["triggered"]), schedulers.AnyBranchScheduler(name="sched", builderNames=["main"]) ] f = BuildFactory() f.addStep( steps.Trigger(schedulerNames=['trigsched'], waitForFinish=True, updateSourceStamp=True)) f.addStep(steps.ShellCommand(command='echo world')) mainBuilder = BuilderConfig(name="main", workernames=["local1"], factory=f) triggeredBuilderKwargs = { 'name': "triggered", 'workernames': ["local1"], 'factory': triggeredFactory } if nextBuild is not None: triggeredBuilderKwargs['nextBuild'] = nextBuild triggeredBuilder = BuilderConfig(**triggeredBuilderKwargs) c['builders'] = [mainBuilder, triggeredBuilder] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers, reporters c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] notifier = reporters.PushoverNotifier( '1234', 'abcd', mode="all", watchedWorkers=['local1'], messageFormatter=MessageFormatter(template='This is a message.'), messageFormatterMissingWorker=MessageFormatterMissingWorker( template='No worker.')) c['services'] = [ reporters.MailNotifier("*****@*****.**", mode="all"), notifier ] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers c['schedulers'] = [ schedulers.Triggerable(name="trigsched", builderNames=["build"]), schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) f.addStep( steps.Trigger(schedulerNames=['trigsched'], waitForFinish=True, updateSourceStamp=True)) f.addStep(steps.ShellCommand(command='echo world')) f2 = BuildFactory() f2.addStep(steps.ShellCommand(command='echo ola')) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f), BuilderConfig(name="build", workernames=["local1"], factory=f2) ] return c
def _getAnyBranchScheduler(name, builderNames, change_filter=None, properties=dict()): return schedulers.AnyBranchScheduler( name=name, # NB: Do not make this a string, a horribly unclear error occurs and nothing works for this scheduler... treeStableTimer={{stability_limit}}, builderNames=builderNames, properties=properties, change_filter=change_filter)
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] triggereables = [] for i in range(NUM_CONCURRENT): c['schedulers'].append( schedulers.Triggerable(name="trigsched" + str(i), builderNames=["build"])) triggereables.append("trigsched" + str(i)) f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) f.addStep( steps.Trigger(schedulerNames=triggereables, waitForFinish=True, updateSourceStamp=True)) f.addStep(steps.ShellCommand(command='echo world')) f2 = BuildFactory() f2.addStep(steps.ShellCommand(command='echo ola')) c['builders'] = [ BuilderConfig(name="testy", workernames=["hyper0"], factory=f), BuilderConfig( name="build", workernames=["hyper" + str(i) for i in range(NUM_CONCURRENT)], factory=f2) ] hyperconfig = workerhyper.Hyper.guess_config() if isinstance(hyperconfig, string_types): hyperconfig = json.load(open(hyperconfig)) hyperhost, hyperconfig = hyperconfig['clouds'].items()[0] masterFQDN = os.environ.get('masterFQDN') c['workers'] = [ HyperLatentWorker('hyper' + str(i), 'passwd', hyperhost, hyperconfig['accesskey'], hyperconfig['secretkey'], 'buildbot/buildbot-worker:master', masterFQDN=masterFQDN) for i in range(NUM_CONCURRENT) ] # if the masterFQDN is forced (proxy case), then we use 9989 default port # else, we try to find a free port if masterFQDN is not None: c['protocols'] = {"pb": {"port": "tcp:9989"}} else: c['protocols'] = {"pb": {"port": "tcp:0"}} return c
def config_for_master_command(self, **kwargs): c = {} c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.MasterShellCommand(**kwargs)) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers, reporters c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) c['builders'] = [ BuilderConfig(name="testy", slavenames=["local1"], factory=f) ] c['services'] = [reporters.MailNotifier("*****@*****.**", mode="all")] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import schedulers c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(TestCompositeMixinStep()) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.MasterShellCommand(command='echo hello')) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] return c
def masterConfig(): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps c['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched1", builderNames=["testy1"]), schedulers.ForceScheduler(name="sched2", builderNames=["testy2"]) ] f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) c['builders'] = [ BuilderConfig(name=name, workernames=["local1"], factory=f) for name in ['testy1', 'testy2'] ] return c
def masterConfig(build_set_summary): c = {} from buildbot.config import BuilderConfig from buildbot.process.factory import BuildFactory from buildbot.plugins import steps, schedulers, reporters c['schedulers'] = [ schedulers.AnyBranchScheduler( name="sched", builderNames=["testy"]) ] f = BuildFactory() f.addStep(steps.ShellCommand(command='echo hello')) c['builders'] = [ BuilderConfig(name="testy", workernames=["local1"], factory=f) ] formatter = MessageFormatter(template='This is a message.') formatter_worker = MessageFormatterMissingWorker(template='No worker.') if build_set_summary: generators_mail = [ BuildSetStatusGenerator(mode='all'), WorkerMissingGenerator(workers='all'), ] generators_pushover = [ BuildSetStatusGenerator(mode='all', message_formatter=formatter), WorkerMissingGenerator(workers=['local1'], message_formatter=formatter_worker), ] else: generators_mail = [ BuildStatusGenerator(mode='all'), WorkerMissingGenerator(workers='all'), ] generators_pushover = [ BuildStatusGenerator(mode='all', message_formatter=formatter), WorkerMissingGenerator(workers=['local1'], message_formatter=formatter_worker), ] c['services'] = [ reporters.MailNotifier("*****@*****.**", generators=generators_mail), reporters.PushoverNotifier('1234', 'abcd', generators=generators_pushover) ] return c
def setupSchedulers(self, _schedulers, spawner_name, try_name, deploy_name, importantManager, codebases, dep_properties): filt = dict(repository=self.repository) if self.branch is not None: filt['branch'] = self.branch _schedulers.append(schedulers.AnyBranchScheduler( name=spawner_name, builderNames=[spawner_name], change_filter=util.ChangeFilter(**filt), onlyImportant=True, fileIsImportant=importantManager.fileIsImportant, codebases=codebases, )) _schedulers.append(schedulers.ForceScheduler( name="force" + spawner_name, builderNames=[spawner_name], codebases=self.createCodebaseParams(codebases))) _schedulers.append(schedulers.ForceScheduler( name=deploy_name, builderNames=[deploy_name], codebases=self.createCodebaseParamsForDeploy(codebases), properties=dep_properties))
def test_shell(self): cfg = masterConfig() yield self.setupConfig(cfg) change = dict(branch="master", files=["foo.c"], author="*****@*****.**", comments="good stuff", revision="HEAD", project="none") # switch the configuration of the scheduler, and make sure the correct builder is run cfg['schedulers'] = [ schedulers.AnyBranchScheduler(name="sched1", builderNames=["testy2"]), schedulers.ForceScheduler(name="sched2", builderNames=["testy1"]) ] yield self.master.reconfig() build = yield self.doForceBuild(wantSteps=True, useChange=change, wantLogs=True) self.assertEqual(build['buildid'], 1) builder = yield self.master.data.get(('builders', build['builderid'])) self.assertEqual(builder['name'], 'testy2')
def getSchedulers(props): pretty_branch_name = props['branch_pretty'] sched_dict = _getBasicSchedulers(props) scheduler_list = list(sched_dict.values()) if props['deploy_env']: scheduler_list.append( schedulers.Dependent( name=pretty_branch_name + " Ansible Deploy", upstream=sched_dict['package'], properties=props, builderNames=[pretty_branch_name + " Ansible Deploy"])) forceBuildNames = [ common.getBuildWithJDK(pretty_branch_name, "Build", jdk) for jdk in common.getJDKBuilds(props) ] forceBuild = _getForceScheduler(props, "ForceBuild", forceBuildNames) scheduler_list.append(forceBuild) tag_sched = schedulers.AnyBranchScheduler( name=pretty_branch_name + " Release", #Note: The branch_regex here is matching something like "11.1", so we use the major version (11), plus a static .* change_filter=util.ChangeFilter(category='tag', branch_re=props['pkg_major_version'] + ".*"), properties=props, builderNames=[pretty_branch_name + " Release"]) scheduler_list.append(tag_sched) forceBuilders = [ common.getBuildWithJDK(pretty_branch_name, "Reports", jdk) for jdk in common.getJDKBuilds(props, pretty_branch_name) ] forceBuilders.extend([ pretty_branch_name + " Markdown", # pretty_branch_name + " Database Tests", pretty_branch_name + " Debian Packaging", pretty_branch_name + " el7 RPM Packaging", pretty_branch_name + " el8 RPM Packaging" ]) if props['deploy_env']: forceBuilders.append(pretty_branch_name + " Ansible Deploy") forceOther = _getForceScheduler(props, "ForceBuildOther", forceBuilders) scheduler_list.append(forceOther) if props['package_all']: forcePackage = schedulers.Dependent( name=pretty_branch_name + " Force Packaging Generation", upstream=forceBuild, properties=props, builderNames=[ pretty_branch_name + " Debian Packaging", pretty_branch_name + " el7 RPM Packaging", pretty_branch_name + " el8 RPM Packaging" ]) scheduler_list.append(forcePackage) if props['deploy_env']: forceAnsible = schedulers.Dependent( name=pretty_branch_name + " Force Ansible Deploy", upstream=forcePackage, properties=props, builderNames=[pretty_branch_name + " Ansible Deploy"]) scheduler_list.append(forceAnsible) return scheduler_list
def get(builders): scheds = [] # pull request scheduler scheds.append( schedulers.AnyBranchScheduler( name="gr_pull_request_handler", change_filter=util.ChangeFilter(category='pull', project="gnuradio/gnuradio"), treeStableTimer=None, builderNames=[ b.name for b in builders if "control" in b.tags and "gnuradio" in b.tags and "pull" in b.tags ])) scheds.append( schedulers.AnyBranchScheduler( name="volk_pull_request_handler", change_filter=util.ChangeFilter(category='pull', project="gnuradio/volk"), treeStableTimer=None, builderNames=[ b.name for b in builders if "control" in b.tags and "volk" in b.tags and "pull" in b.tags ])) # push event scheduler def filter_for_push(change): event = change.properties.getProperty("event") project = change.properties.getProperty("project") if event == "push": return True return False scheds.append( schedulers.AnyBranchScheduler( name="commit_push_handler", change_filter=util.ChangeFilter(filter_fn=filter_for_push, project="gnuradio/gnuradio"), treeStableTimer=60, builderNames=[ b.name for b in builders if "control" in b.tags and "push" in b.tags ])) scheds.append( schedulers.ForceScheduler( name="force_pullrequest", builderNames=["pull_request_runner"], properties=[ util.StringParameter(name="github.number", label="GitHub pull request number", default="", size=80), util.StringParameter(name="github.base.ref", label="pull request base branch", default="master", size=80) ], codebases=[ util.CodebaseParameter( "", project=util.FixedParameter(name="project", default="gnuradio/gnuradio"), repository=util.FixedParameter( name="repository", default="https://github.com/gnuradio/gnuradio.git"), branch=util.StringParameter( name="branch", label="pull request branch", default="refs/pull/<PR#>/merge", size=80), revision=util.FixedParameter(name="revision", default="")) ])) scheds.append( schedulers.ForceScheduler( name="force_build", builderNames=["repo_push_runner"], codebases=[ util.CodebaseParameter( "", project=util.FixedParameter(name="project", default="gnuradio/gnuradio"), repository=util.FixedParameter( name="repository", default="https://github.com/gnuradio/gnuradio.git"), ) ])) scheds.append( schedulers.ForceScheduler( name="force_weekly", builderNames=["weekly_runner"], codebases=[ util.CodebaseParameter( "", project=util.FixedParameter(name="project", default="gnuradio/gnuradio"), repository=util.FixedParameter( name="repository", default="https://github.com/gnuradio/gnuradio.git"), branch=util.StringParameter(name="branch", label="test branch", default="master", size=80), revision=util.FixedParameter(name="revision", default="")) ])) scheds.append( schedulers.Nightly(name="timed_weekly", builderNames=["weekly_runner"], codebases={ "": { "repository": "https://github.com/gnuradio/gnuradio.git", "branch": "master", "revision": "None" } }, dayOfWeek=[0, 4], hour=4, minute=0)) scheds.extend([ schedulers.Triggerable(name="trigger_" + b.name.lstrip("build_"), builderNames=[b.name]) for b in builders if "build" in b.tags ]) scheds.extend([ schedulers.Triggerable(name="trigger_" + b.name.lstrip("test_"), builderNames=[b.name]) for b in builders if "test" in b.tags ]) return scheds
# --master option) c['protocols'] = {'pb': {'port': 9989}} ####### CHANGESOURCES # the 'change_source' setting tells the buildmaster how it should find out # about source code changes. Here we point to the buildbot clone of pyflakes. c['change_source'] = [] ####### SCHEDULERS # Configure the Schedulers, which decide how to react to incoming changes. In this # case, just kick off a 'runtests' build c['schedulers'] = [] c['schedulers'].append( schedulers.AnyBranchScheduler(name="all", builderNames=["cite-build"])) c['schedulers'].append( schedulers.ForceScheduler(name="force", builderNames=["cite-build"])) ####### BUILDERS # The 'builders' list defines the Builders, which tell Buildbot how to perform a build: # what steps, and which workers can execute them. Note that any particular build will # only take place on one worker. factory = util.BuildFactory() # change workdir for each projects factory.workdir = util.Interpolate('%(src::project)s') # check out the source factory.addStep(