Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Recipe module to ensure a checkout is consistant on a bot.""" | 6 """Recipe module to ensure a checkout is consistant on a bot.""" |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 201 |
| 202 # Add suffixes to the step name, if specified. | 202 # Add suffixes to the step name, if specified. |
| 203 name = 'bot_update' | 203 name = 'bot_update' |
| 204 if not patch: | 204 if not patch: |
| 205 name += ' (without patch)' | 205 name += ' (without patch)' |
| 206 if suffix: | 206 if suffix: |
| 207 name += ' - %s' % suffix | 207 name += ' - %s' % suffix |
| 208 | 208 |
| 209 # Ah hah! Now that everything is in place, lets run bot_update! | 209 # Ah hah! Now that everything is in place, lets run bot_update! |
| 210 try: | 210 try: |
| 211 # 88 is the 'patch failure' return code. | 211 # 87 and 88 are the 'patch failure' codes for patch download and patch |
| 212 self(name, cmd, step_test_data=step_test_data, ok_ret=(0, 88), **kwargs) | 212 # apply, respectively. |
|
Sergiy Byelozyorov
2015/10/02 13:37:50
add a comment that we do not check them here, but
tandrii(chromium)
2015/10/02 13:49:44
Done.
| |
| 213 self(name, cmd, step_test_data=step_test_data, | |
| 214 ok_ret=(0, 87, 88), **kwargs) | |
| 213 finally: | 215 finally: |
| 214 step_result = self.m.step.active_result | 216 step_result = self.m.step.active_result |
| 215 self._properties = step_result.json.output.get('properties', {}) | 217 self._properties = step_result.json.output.get('properties', {}) |
| 216 | 218 |
| 217 if update_presentation: | 219 if update_presentation: |
| 218 # Set properties such as got_revision. | 220 # Set properties such as got_revision. |
| 219 for prop_name, prop_value in self.properties.iteritems(): | 221 for prop_name, prop_value in self.properties.iteritems(): |
| 220 step_result.presentation.properties[prop_name] = prop_value | 222 step_result.presentation.properties[prop_name] = prop_value |
| 221 # Add helpful step description in the step UI. | 223 # Add helpful step description in the step UI. |
| 222 if 'step_text' in step_result.json.output: | 224 if 'step_text' in step_result.json.output: |
| 223 step_text = step_result.json.output['step_text'] | 225 step_text = step_result.json.output['step_text'] |
| 224 step_result.presentation.step_text = step_text | 226 step_result.presentation.step_text = step_text |
| 225 # Add log line output. | 227 # Add log line output. |
| 226 if 'log_lines' in step_result.json.output: | 228 if 'log_lines' in step_result.json.output: |
| 227 for log_name, log_lines in step_result.json.output['log_lines']: | 229 for log_name, log_lines in step_result.json.output['log_lines']: |
| 228 step_result.presentation.logs[log_name] = log_lines.splitlines() | 230 step_result.presentation.logs[log_name] = log_lines.splitlines() |
| 229 | 231 |
| 230 # Set the "checkout" path for the main solution. | 232 # Set the "checkout" path for the main solution. |
| 231 # This is used by the Chromium module to figure out where to look for | 233 # This is used by the Chromium module to figure out where to look for |
| 232 # the checkout. | 234 # the checkout. |
| 233 # If there is a patch failure, emit another step that said things failed. | 235 # If there is a patch failure, emit another step that said things failed. |
| 234 if step_result.json.output.get('patch_failure'): | 236 if step_result.json.output.get('patch_failure'): |
| 235 # TODO(phajdan.jr): Differentiate between failure to download the patch | 237 return_code = step_result.json.output.get('patch_apply_return_code') |
| 236 # and failure to apply it. The first is an infra failure, the latter | 238 if return_code == 3: |
|
Sergiy Byelozyorov
2015/10/02 13:06:35
now you also need to change 3 to 87
Sergiy Byelozyorov
2015/10/02 13:37:50
discussed offline... this is actually correct
| |
| 237 # a definite patch failure. | 239 # This is download failure, hence an infra failure. |
| 238 self.m.tryserver.set_patch_failure_tryjob_result() | 240 raise self.m.step.InfraFailure('Failed to download the patch') |
| 241 else: | |
| 242 # This is actual patch failure. | |
| 243 self.m.tryserver.set_patch_failure_tryjob_result() | |
| 239 self.m.python.failing_step( | 244 self.m.python.failing_step( |
| 240 'Patch failure', 'Check the bot_update step for details') | 245 'Patch failure', 'Check the bot_update step for details') |
| 241 | 246 |
| 242 # bot_update actually just sets root to be the folder name of the | 247 # bot_update actually just sets root to be the folder name of the |
| 243 # first solution. | 248 # first solution. |
| 244 if step_result.json.output['did_run']: | 249 if step_result.json.output['did_run']: |
| 245 co_root = step_result.json.output['root'] | 250 co_root = step_result.json.output['root'] |
| 246 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 251 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
| 247 if 'checkout' not in self.m.path: | 252 if 'checkout' not in self.m.path: |
| 248 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 253 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
| 249 | 254 |
| 250 return step_result | 255 return step_result |
| OLD | NEW |