Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: PRESUBMIT.py

Issue 1152823005: Use script in depot_tools to retrieve builders from new cq.cfg (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also pass shell=True to allow resolution of the binary without extension on Windows Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/commit_queue/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 # commit_queue.py below is a script in depot_tools directory, which has a
1793 change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: 1794 # 'builders' command to retrieve a list of CQ builders from the CQ config.
1794 cq_config = json.load(f) 1795 masters = json.loads(subprocess.check_output(
1795 cq_verifiers = cq_config.get('verifiers_no_patch', {}) 1796 ['commit_queue', 'builders', cq_config_path], shell=True))
1796 cq_try_jobs = cq_verifiers.get('try_job_verifier', {})
1797 builders = cq_try_jobs.get('launched', {})
1798 1797
1799 for master, master_config in cq_try_jobs.get('triggered', {}).iteritems(): 1798 # Explicitly iterate over copies of keys since we mutate them.
1800 for triggered_bot in master_config: 1799 for master in masters.keys():
1801 builders.get(master, {}).pop(triggered_bot, None) 1800 for builder in masters[master].keys():
1801 # Do not trigger presubmit builders, since they're likely to fail
1802 # (e.g. OWNERS checks before finished code review), and we're
1803 # running local presubmit anyway.
1804 if 'presubmit' in builder:
1805 masters[master].pop(builder)
1806 else:
1807 # Convert testfilter format to the one expected by git-cl-try.
1808 testfilter = masters[master][builder].get('testfilter', 'defaulttests')
1809 masters[master][builder] = [testfilter]
1802 1810
1803 # Explicitly iterate over copies of dicts since we mutate them. 1811 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
OLDNEW
« no previous file with comments | « no previous file | testing/commit_queue/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698