diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 5a13d2fac8151c..751ae525751be3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -1784,28 +1784,29 @@ def CheckChangeOnCommit(input_api, output_api): def GetPreferredTryMasters(project, change): - import json - 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] + import re + files = change.LocalPaths() - return masters + 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 diff --git a/testing/commit_queue/OWNERS b/testing/commit_queue/OWNERS new file mode 100644 index 00000000000000..b8fe80c33379f4 --- /dev/null +++ b/testing/commit_queue/OWNERS @@ -0,0 +1,7 @@ +# This is needed because of * in testing/OWNERS . +set noparent + +phajdan.jr@chromium.org +sergeyberezin@chromium.org +sergiyb@chromium.org +sheyang@chromium.org diff --git a/testing/commit_queue/config.json b/testing/commit_queue/config.json new file mode 100644 index 00000000000000..b210ccc312bddf --- /dev/null +++ b/testing/commit_queue/config.json @@ -0,0 +1,102 @@ +{ + "_comment1": "This file is no longer used by CQ. Instead CQ reads", + "_comment2": "infra/config/cq.cfg. However, this file is still used by", + "_comment3": "git-cl-try and thus this list must be manually kept in sync", + "_comment4": "to the list of builders in infra/config/cq.cfg. We apologize", + "_comment5": "for the incovenience and are working on a fix that will make", + "_comment6": "git-cl-try also read infra/config/cq.cfg.", + + "verifiers_no_patch": { + "try_job_verifier": { + "launched": { + "tryserver.chromium.linux": { + "android_arm64_dbg_recipe": [ + "defaulttests" + ], + "android_chromium_gn_compile_dbg": [ + "defaulttests" + ], + "android_chromium_gn_compile_rel": [ + "defaulttests" + ], + "android_clang_dbg_recipe": [ + "defaulttests" + ], + "android_compile_dbg": [ + "defaulttests" + ], + "cast_shell_android": [ + "defaulttests" + ], + "cast_shell_linux": [ + "defaulttests" + ], + "chromium_presubmit": [ + "defaulttests" + ], + "linux_android_rel_ng": [ + "defaulttests" + ], + "linux_chromium_asan_rel_ng": [ + "defaulttests" + ], + "linux_chromium_chromeos_compile_dbg_ng": [ + "defaulttests" + ], + "linux_chromium_chromeos_ozone_rel_ng": [ + "defaulttests" + ], + "linux_chromium_chromeos_rel_ng": [ + "defaulttests" + ], + "linux_chromium_clobber_rel_ng": [ + "defaulttests" + ], + "linux_chromium_compile_dbg_32_ng": [ + "compile" + ], + "linux_chromium_gn_chromeos_rel": [ + "defaulttests" + ], + "linux_chromium_gn_dbg": [ + "defaulttests" + ], + "linux_chromium_gn_rel": [ + "defaulttests" + ], + "linux_chromium_rel_ng": [ + "defaulttests" + ] + }, + "tryserver.chromium.mac": { + "ios_dbg_simulator_ninja": [ + "defaulttests" + ], + "ios_rel_device_ninja": [ + "defaulttests" + ], + "mac_chromium_compile_dbg_ng": [ + "defaulttests" + ], + "mac_chromium_rel_ng": [ + "defaulttests" + ] + }, + "tryserver.chromium.win": { + "win8_chromium_rel": [ + "defaulttests" + ], + "win_chromium_compile_dbg_ng": [ + "defaulttests" + ], + "win_chromium_rel_ng": [ + "defaulttests" + ], + "win_chromium_x64_rel_ng": [ + "defaulttests" + ] + } + } + } + } +}