| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 """An interface to git-cl. | 5 """An interface to git-cl. |
| 6 | 6 |
| 7 The git-cl tool is responsible for communicating with Rietveld, Gerrit, | 7 The git-cl tool is responsible for communicating with Rietveld, Gerrit, |
| 8 and Buildbucket to manage changelists and try jobs associated with them. | 8 and Buildbucket to manage changelists and try jobs associated with them. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 self._auth_refresh_token_json = auth_refresh_token_json | 28 self._auth_refresh_token_json = auth_refresh_token_json |
| 29 self._cwd = cwd | 29 self._cwd = cwd |
| 30 | 30 |
| 31 def run(self, args): | 31 def run(self, args): |
| 32 """Runs git-cl with the given arguments and returns the output.""" | 32 """Runs git-cl with the given arguments and returns the output.""" |
| 33 command = ['git', 'cl'] + args | 33 command = ['git', 'cl'] + args |
| 34 if self._auth_refresh_token_json and args[0] in _COMMANDS_THAT_TAKE_REFR
ESH_TOKEN: | 34 if self._auth_refresh_token_json and args[0] in _COMMANDS_THAT_TAKE_REFR
ESH_TOKEN: |
| 35 command += ['--auth-refresh-token-json', self._auth_refresh_token_js
on] | 35 command += ['--auth-refresh-token-json', self._auth_refresh_token_js
on] |
| 36 return self._host.executive.run_command(command, cwd=self._cwd) | 36 return self._host.executive.run_command(command, cwd=self._cwd) |
| 37 | 37 |
| 38 def trigger_try_jobs(self, builders=None): |
| 39 builders = builders or self._host.builders.all_try_builder_names() |
| 40 if 'android_blink_rel' in builders: |
| 41 self.run(['try', '-b', 'android_blink_rel']) |
| 42 builders.remove('android_blink_rel') |
| 43 # TODO(qyearsley): Stop explicitly adding the master name when |
| 44 # git cl try can get the master name; see http://crbug.com/700523. |
| 45 command = ['try', '-m', 'tryserver.blink'] |
| 46 for builder in sorted(builders): |
| 47 command.extend(['-b', builder]) |
| 48 self.run(command) |
| 49 |
| 38 def get_issue_number(self): | 50 def get_issue_number(self): |
| 39 return self.run(['issue']).split()[2] | 51 return self.run(['issue']).split()[2] |
| 40 | 52 |
| 41 def wait_for_try_jobs(self, poll_delay_seconds=10 * 60, timeout_seconds=120
* 60): | 53 def wait_for_try_jobs(self, poll_delay_seconds=10 * 60, timeout_seconds=120
* 60): |
| 42 """Waits until all try jobs are finished. | 54 """Waits until all try jobs are finished. |
| 43 | 55 |
| 44 Args: | 56 Args: |
| 45 poll_delay_seconds: Time to wait between fetching results. | 57 poll_delay_seconds: Time to wait between fetching results. |
| 46 timeout_seconds: Time to wait before aborting. | 58 timeout_seconds: Time to wait before aborting. |
| 47 | 59 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 assert build_number and build_number.isdigit() | 103 assert build_number and build_number.isdigit() |
| 92 return Build(builder_name, int(build_number)) | 104 return Build(builder_name, int(build_number)) |
| 93 | 105 |
| 94 @staticmethod | 106 @staticmethod |
| 95 def all_jobs_finished(try_results): | 107 def all_jobs_finished(try_results): |
| 96 return all(r.get('status') == 'COMPLETED' for r in try_results) | 108 return all(r.get('status') == 'COMPLETED' for r in try_results) |
| 97 | 109 |
| 98 @staticmethod | 110 @staticmethod |
| 99 def has_failing_try_results(try_results): | 111 def has_failing_try_results(try_results): |
| 100 return any(r.get('result') == 'FAILURE' for r in try_results) | 112 return any(r.get('result') == 'FAILURE' for r in try_results) |
| OLD | NEW |