Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1777 json_url='http://chromium-status.appspot.com/current?format=json')) | 1777 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 1778 | 1778 |
| 1779 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 1779 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 1780 input_api, output_api)) | 1780 input_api, output_api)) |
| 1781 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1781 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 1782 input_api, output_api)) | 1782 input_api, output_api)) |
| 1783 return results | 1783 return results |
| 1784 | 1784 |
| 1785 | 1785 |
| 1786 def GetPreferredTryMasters(project, change): | 1786 def GetPreferredTryMasters(project, change): |
| 1787 import re | 1787 import json |
| 1788 files = change.LocalPaths() | 1788 import os.path |
| 1789 import subprocess | |
| 1789 | 1790 |
| 1790 import os | 1791 cq_config_path = os.path.join( |
| 1791 import json | 1792 change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') |
| 1792 with open(os.path.join( | 1793 masters = json.loads(subprocess.check_output( |
| 1793 change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: | 1794 ['commit_queue.py', 'builders', cq_config_path])) |
|
pgervais
2015/05/29 17:05:51
The name 'commit_queue.py' is so confusing in this
Sergiy Byelozyorov
2015/05/29 17:08:23
I'll add a comment.
| |
| 1794 cq_config = json.load(f) | |
| 1795 cq_verifiers = cq_config.get('verifiers_no_patch', {}) | |
| 1796 cq_try_jobs = cq_verifiers.get('try_job_verifier', {}) | |
| 1797 builders = cq_try_jobs.get('launched', {}) | |
| 1798 | 1795 |
| 1799 for master, master_config in cq_try_jobs.get('triggered', {}).iteritems(): | 1796 # Explicitly iterate over copies of dicts since we mutate them. |
|
pgervais
2015/05/29 17:05:50
'of dicts' -> 'of keys' ?
Sergiy Byelozyorov
2015/05/29 17:08:23
Done.
| |
| 1800 for triggered_bot in master_config: | 1797 for master in masters.keys(): |
| 1801 builders.get(master, {}).pop(triggered_bot, None) | 1798 for builder in masters[master].keys(): |
| 1799 # Do not trigger presubmit builders, since they're likely to fail | |
| 1800 # (e.g. OWNERS checks before finished code review), and we're | |
| 1801 # running local presubmit anyway. | |
| 1802 if 'presubmit' in builder: | |
| 1803 masters[master].pop(builder) | |
| 1804 else: | |
| 1805 # Convert testfilter format to the one expected by git-cl-try. | |
| 1806 testfilter = masters[master][builder].get('testfilter', 'defaulttests') | |
| 1807 masters[master][builder] = [testfilter] | |
| 1802 | 1808 |
| 1803 # Explicitly iterate over copies of dicts since we mutate them. | 1809 return masters |
| 1804 for master in builders.keys(): | |
| 1805 for builder in builders[master].keys(): | |
| 1806 # Do not trigger presubmit builders, since they're likely to fail | |
| 1807 # (e.g. OWNERS checks before finished code review), and we're | |
| 1808 # running local presubmit anyway. | |
| 1809 if 'presubmit' in builder: | |
| 1810 builders[master].pop(builder) | |
| 1811 | |
| 1812 return builders | |
| OLD | NEW |