| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import json | 5 import json |
| 6 import uuid | 6 import uuid |
| 7 | 7 |
| 8 # This is a wrapper class of revision that stores its build path and | 8 # This is a wrapper class of revision that stores its build path and |
| 9 # queries its status. Part of the code are adapted from the RevisionState | 9 # queries its status. Part of the code are adapted from the RevisionState |
| 10 # class from auto-bisect module | 10 # class from auto-bisect module |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket | 48 return 'gs://%s/Linux Builder/full-build-linux' % self.bucket |
| 49 | 49 |
| 50 def _is_completed(self): | 50 def _is_completed(self): |
| 51 result = self.api.m.buildbucket.get_build( | 51 result = self.api.m.buildbucket.get_build( |
| 52 self.build_id, | 52 self.build_id, |
| 53 step_test_data=lambda: self.api.m.json.test_api.output_stream( | 53 step_test_data=lambda: self.api.m.json.test_api.output_stream( |
| 54 {'build': {'status': 'COMPLETED'}} | 54 {'build': {'status': 'COMPLETED'}} |
| 55 )) | 55 )) |
| 56 return result.stdout['build']['status'] == 'COMPLETED' | 56 return result.stdout['build']['status'] == 'COMPLETED' |
| 57 | 57 |
| 58 def _is_build_archived(self): # pragma: no cover | 58 def _is_build_successful(self): # pragma: no cover |
| 59 result = self.api.m.buildbucket.get_build( | 59 result = self.api.m.buildbucket.get_build( |
| 60 self.build_id, | 60 self.build_id, |
| 61 step_test_data=lambda: self.api.m.json.test_api.output_stream( | 61 step_test_data=lambda: self.api.m.json.test_api.output_stream( |
| 62 {'build': {'result': 'SUCCESS'}} | 62 {'build': {'result': 'SUCCESS', 'url': 'buildbot.dummy.url/job/12'}} |
| 63 )) | 63 )) |
| 64 return result.stdout['build']['result'] == 'SUCCESS' | 64 return (result.stdout['build']['result'] == 'SUCCESS', |
| 65 result.stdout['build']['url']) |
| 65 | 66 |
| 66 # Duplicate code from auto_bisect.bisector.get_builder_bot_for_this_platform | 67 # Duplicate code from auto_bisect.bisector.get_builder_bot_for_this_platform |
| 67 def get_builder_bot_for_this_platform(self): # pragma: no cover | 68 def get_builder_bot_for_this_platform(self): # pragma: no cover |
| 68 bot_name = self.api.m.properties.get('buildername', '') | 69 bot_name = self.api.m.properties.get('buildername', '') |
| 69 if 'win' in bot_name: | 70 if 'win' in bot_name: |
| 70 if any(b in bot_name for b in ['x64', 'gpu']): | 71 if any(b in bot_name for b in ['x64', 'gpu']): |
| 71 return 'winx64_bisect_builder' | 72 return 'winx64_bisect_builder' |
| 72 return 'win_perf_bisect_builder' | 73 return 'win_perf_bisect_builder' |
| 73 | 74 |
| 74 if 'android' in bot_name: | 75 if 'android' in bot_name: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 'tags':{} | 115 'tags':{} |
| 115 } | 116 } |
| 116 result = self.api.m.buildbucket.put( | 117 result = self.api.m.buildbucket.put( |
| 117 [build_details], | 118 [build_details], |
| 118 self.api.m.service_account.get_json_path(SERVICE_ACCOUNT)) | 119 self.api.m.service_account.get_json_path(SERVICE_ACCOUNT)) |
| 119 self.build_id = result.stdout['results'][0]['build']['id'] | 120 self.build_id = result.stdout['results'][0]['build']['id'] |
| 120 | 121 |
| 121 def wait_for(self): # pragma: no cover | 122 def wait_for(self): # pragma: no cover |
| 122 while True: | 123 while True: |
| 123 if self._is_completed(): | 124 if self._is_completed(): |
| 124 if self._is_build_archived(): | 125 succeeded, build_url = self._is_build_successful() |
| 126 if succeeded: |
| 125 break | 127 break |
| 128 self.api.m.step.active_result.presentation.status = ( |
| 129 self.api.m.step.WARNING) |
| 130 self.api.m.step.active_result.presentation.links['FAILED BUILD'] = ( |
| 131 build_url) |
| 132 self.api.m.halt('Build %s patch failed' % ( |
| 133 'with' if self.with_patch else 'without')) |
| 126 raise self.api.m.step.StepFailure('Build %s fails' % self.build_id) | 134 raise self.api.m.step.StepFailure('Build %s fails' % self.build_id) |
| 127 else: | 135 else: |
| 128 self.api.m.python.inline( | 136 self.api.m.python.inline( |
| 129 'sleeping', | 137 'sleeping', |
| 130 """ | 138 """ |
| 131 import sys | 139 import sys |
| 132 import time | 140 import time |
| 133 time.sleep(20*60) | 141 time.sleep(20*60) |
| 134 sys.exit(0) | 142 sys.exit(0) |
| 135 """) | 143 """) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 import sys | 182 import sys |
| 175 shutil.move(sys.argv[1], sys.argv[2]) | 183 shutil.move(sys.argv[1], sys.argv[2]) |
| 176 """, | 184 """, |
| 177 args=[zip_dir, build_dir]) | 185 args=[zip_dir, build_dir]) |
| 178 else: | 186 else: |
| 179 self.api.m.chromium_tests.download_and_unzip_build( | 187 self.api.m.chromium_tests.download_and_unzip_build( |
| 180 mastername, buildername, update_step, bot_db, | 188 mastername, buildername, update_step, bot_db, |
| 181 build_archive_url=self.build_file_path, | 189 build_archive_url=self.build_file_path, |
| 182 build_revision=self.commit_hash, | 190 build_revision=self.commit_hash, |
| 183 override_bot_type='tester') | 191 override_bot_type='tester') |
| OLD | NEW |