| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from master.factory import annotator_commands |
| 6 from master.factory import commands |
| 7 from master.factory.build_factory import BuildFactory |
| 8 |
| 9 |
| 10 def KitchenFactory(active_master, repository, recipe, |
| 11 revision='origin/master', factory_properties=None, |
| 12 timeout=1200, max_time=2400): |
| 13 """Returns buildbot build factory which runs recipes locally using kitchen. |
| 14 |
| 15 |active_master| is config_bootstrap.Master's subclass from master's |
| 16 master_site_config.py . |
| 17 |
| 18 |repository| is the URL of repository containing recipe to run. |
| 19 |
| 20 |recipe| is the name of the recipe to pass to kitchen_run. |
| 21 |
| 22 |revision| is the revision to use for repo checkout (by default we use latest |
| 23 revision). |
| 24 |
| 25 |factory_properties| is a dictionary of default build properties. |
| 26 |
| 27 |timeout| refers to the maximum number of seconds a build should be allowed |
| 28 to run without output. After no output for |timeout| seconds, the build is |
| 29 forcibly killed. |
| 30 |
| 31 |max_time| refers to the maximum number of seconds a build should be allowed |
| 32 to run, regardless of output. After |max_time| seconds, the build is |
| 33 forcibly killed. |
| 34 """ |
| 35 factory = BuildFactory(build_inherit_factory_properties=False) |
| 36 factory.properties.update(factory_properties or {}, 'KitchenFactory') |
| 37 cmd_obj = annotator_commands.AnnotatorCommands( |
| 38 factory, active_master=active_master) |
| 39 |
| 40 runner = cmd_obj.PathJoin(cmd_obj.script_dir, 'kitchen_run.py') |
| 41 cmd = [ |
| 42 cmd_obj.python, '-u', runner, |
| 43 '--repository', repository, |
| 44 '--revision', revision, |
| 45 '--recipe', recipe, |
| 46 ] |
| 47 cmd = cmd_obj.AddB64GzBuildProperties(cmd) |
| 48 |
| 49 cmd_obj.AddAnnotatedScript(cmd, timeout=timeout, max_time=max_time) |
| 50 |
| 51 return factory |
| OLD | NEW |