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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testing/commit_queue/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 751ae525751be38445e4bca2fd0a02c0ac7dd03e..5a13d2fac8151cd30a76b8144fce2d20e680cd5a 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1784,29 +1784,28 @@ def CheckChangeOnCommit(input_api, output_api):
def GetPreferredTryMasters(project, change):
- import re
- files = change.LocalPaths()
-
- import os
import json
- with open(os.path.join(
- change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f:
- cq_config = json.load(f)
- cq_verifiers = cq_config.get('verifiers_no_patch', {})
- cq_try_jobs = cq_verifiers.get('try_job_verifier', {})
- builders = cq_try_jobs.get('launched', {})
-
- for master, master_config in cq_try_jobs.get('triggered', {}).iteritems():
- for triggered_bot in master_config:
- builders.get(master, {}).pop(triggered_bot, None)
-
- # Explicitly iterate over copies of dicts since we mutate them.
- for master in builders.keys():
- for builder in builders[master].keys():
- # Do not trigger presubmit builders, since they're likely to fail
- # (e.g. OWNERS checks before finished code review), and we're
- # running local presubmit anyway.
- if 'presubmit' in builder:
- builders[master].pop(builder)
-
- return builders
+ import os.path
+ import subprocess
+
+ cq_config_path = os.path.join(
+ change.RepositoryRoot(), 'infra', 'config', 'cq.cfg')
+ # commit_queue.py below is a script in depot_tools directory, which has a
+ # 'builders' command to retrieve a list of CQ builders from the CQ config.
+ masters = json.loads(subprocess.check_output(
+ ['commit_queue', 'builders', cq_config_path], shell=True))
+
+ # Explicitly iterate over copies of keys since we mutate them.
+ for master in masters.keys():
+ for builder in masters[master].keys():
+ # Do not trigger presubmit builders, since they're likely to fail
+ # (e.g. OWNERS checks before finished code review), and we're
+ # running local presubmit anyway.
+ if 'presubmit' in builder:
+ masters[master].pop(builder)
+ else:
+ # Convert testfilter format to the one expected by git-cl-try.
+ testfilter = masters[master][builder].get('testfilter', 'defaulttests')
+ masters[master][builder] = [testfilter]
+
+ return masters
« 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