| OLD | NEW |
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | 1 # Copyright 2017 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 open_step = self._step_runner.open_step(step_config) | 265 open_step = self._step_runner.open_step(step_config) |
| 266 self._step_stack.append(self.ActiveStep( | 266 self._step_stack.append(self.ActiveStep( |
| 267 config=step_config, | 267 config=step_config, |
| 268 step_result=None, | 268 step_result=None, |
| 269 open_step=open_step)) | 269 open_step=open_step)) |
| 270 | 270 |
| 271 step_result = open_step.run() | 271 step_result = open_step.run() |
| 272 self._step_stack[-1] = ( | 272 self._step_stack[-1] = ( |
| 273 self._step_stack[-1]._replace(step_result=step_result)) | 273 self._step_stack[-1]._replace(step_result=step_result)) |
| 274 | 274 |
| 275 if step_result.retcode in step_config.ok_ret: | 275 if step_result.presentation.status == 'SUCCESS': |
| 276 step_result.presentation.status = 'SUCCESS' | |
| 277 return step_result | 276 return step_result |
| 278 | 277 |
| 279 if not step_config.infra_step: | 278 exc = recipe_api.StepFailure |
| 280 state = 'FAILURE' | 279 if step_result.presentation.status == 'EXCEPTION': |
| 281 exc = recipe_api.StepFailure | |
| 282 else: | |
| 283 state = 'EXCEPTION' | |
| 284 exc = recipe_api.InfraFailure | 280 exc = recipe_api.InfraFailure |
| 285 | 281 |
| 286 step_result.presentation.status = state | |
| 287 | |
| 288 self._step_stack[-1].open_step.stream.write_line( | 282 self._step_stack[-1].open_step.stream.write_line( |
| 289 'step returned non-zero exit code: %d' % step_result.retcode) | 283 'step returned non-zero exit code: %d' % step_result.retcode) |
| 290 | 284 |
| 291 raise exc(step_config.name, step_result) | 285 raise exc(step_config.name, step_result) |
| 292 | 286 |
| 293 def run(self, recipe_script, api, properties): | 287 def run(self, recipe_script, api, properties): |
| 294 """Run a recipe represented by a recipe_script object. | 288 """Run a recipe represented by a recipe_script object. |
| 295 | 289 |
| 296 This function blocks until recipe finishes. | 290 This function blocks until recipe finishes. |
| 297 It mainly executes the recipe, and has some exception handling logic. | 291 It mainly executes the recipe, and has some exception handling logic. |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 ret = run_steps( | 720 ret = run_steps( |
| 727 properties, stream_engine, | 721 properties, stream_engine, |
| 728 step_runner.SubprocessStepRunner(stream_engine, engine_flags), | 722 step_runner.SubprocessStepRunner(stream_engine, engine_flags), |
| 729 universe_view, engine_flags=engine_flags, | 723 universe_view, engine_flags=engine_flags, |
| 730 emit_initial_properties=emit_initial_properties) | 724 emit_initial_properties=emit_initial_properties) |
| 731 finally: | 725 finally: |
| 732 os.chdir(old_cwd) | 726 os.chdir(old_cwd) |
| 733 | 727 |
| 734 return handle_recipe_return( | 728 return handle_recipe_return( |
| 735 ret, args.output_result_json, stream_engine, engine_flags) | 729 ret, args.output_result_json, stream_engine, engine_flags) |
| OLD | NEW |