| OLD | NEW |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Entry point for fully-annotated builds. | 5 """Entry point for fully-annotated builds. |
| 6 | 6 |
| 7 This script is part of the effort to move all builds to annotator-based | 7 This script is part of the effort to move all builds to annotator-based |
| 8 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() | 8 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() |
| 9 found in scripts/master/factory/annotator_factory.py executes a single | 9 found in scripts/master/factory/annotator_factory.py executes a single |
| 10 AddAnnotatedScript step. That step (found in annotator_commands.py) calls | 10 AddAnnotatedScript step. That step (found in annotator_commands.py) calls |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 # Find and load the recipe to run. | 241 # Find and load the recipe to run. |
| 242 try: | 242 try: |
| 243 recipe_script = universe.load_recipe(recipe) | 243 recipe_script = universe.load_recipe(recipe) |
| 244 s.write_line('Running recipe with %s' % (properties,)) | 244 s.write_line('Running recipe with %s' % (properties,)) |
| 245 | 245 |
| 246 api = loader.create_recipe_api(recipe_script.LOADED_DEPS, | 246 api = loader.create_recipe_api(recipe_script.LOADED_DEPS, |
| 247 engine, | 247 engine, |
| 248 recipe_test_api.DisabledTestData()) | 248 recipe_test_api.DisabledTestData()) |
| 249 | 249 |
| 250 s.add_step_text('<br/>running recipe: "%s"' % recipe) | 250 s.add_step_text('running recipe: "%s"' % recipe) |
| 251 except (loader.LoaderError, ImportError, AssertionError) as e: | 251 except (loader.LoaderError, ImportError, AssertionError) as e: |
| 252 s.add_step_text('<br/>%s' % '<br/>'.join(str(e).splitlines())) | 252 for line in str(e).splitlines(): |
| 253 s.add_step_text(line) |
| 253 s.set_step_status('EXCEPTION') | 254 s.set_step_status('EXCEPTION') |
| 254 return RecipeResult({ | 255 return RecipeResult({ |
| 255 'status_code': 2, | 256 'status_code': 2, |
| 256 'reason': str(e), | 257 'reason': str(e), |
| 257 }) | 258 }) |
| 258 | 259 |
| 259 # Run the steps emitted by a recipe via the engine, emitting annotations | 260 # Run the steps emitted by a recipe via the engine, emitting annotations |
| 260 # into |stream| along the way. | 261 # into |stream| along the way. |
| 261 return engine.run(recipe_script, api) | 262 return engine.run(recipe_script, api) |
| 262 | 263 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 results.append( | 487 results.append( |
| 487 loader._invoke_with_properties( | 488 loader._invoke_with_properties( |
| 488 run_recipe, properties, recipe_script.PROPERTIES, | 489 run_recipe, properties, recipe_script.PROPERTIES, |
| 489 properties.keys())) | 490 properties.keys())) |
| 490 except TypeError as e: | 491 except TypeError as e: |
| 491 raise TypeError( | 492 raise TypeError( |
| 492 "Got %r while trying to call recipe %s with properties %r" % ( | 493 "Got %r while trying to call recipe %s with properties %r" % ( |
| 493 e, recipe, properties)) | 494 e, recipe, properties)) |
| 494 | 495 |
| 495 return results | 496 return results |
| OLD | NEW |