| OLD | NEW |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 infra. | 5 """Top-level presubmit script for infra. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 def CheckChangeOnCommit(input_api, output_api): # pragma: no cover | 379 def CheckChangeOnCommit(input_api, output_api): # pragma: no cover |
| 380 output = CommonChecks(input_api, output_api) | 380 output = CommonChecks(input_api, output_api) |
| 381 output.extend(input_api.RunTests( | 381 output.extend(input_api.RunTests( |
| 382 PylintChecks(input_api, output_api, only_changed=False))) | 382 PylintChecks(input_api, output_api, only_changed=False))) |
| 383 output.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 383 output.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
| 384 output.extend(input_api.canned_checks.CheckTreeIsOpen( | 384 output.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 385 input_api, | 385 input_api, |
| 386 output_api, | 386 output_api, |
| 387 json_url='http://infra-status.appspot.com/current?format=json')) | 387 json_url='http://infra-status.appspot.com/current?format=json')) |
| 388 return output | 388 return output |
| 389 | |
| 390 | |
| 391 # Unused argument - pylint: disable=W0613 | |
| 392 def GetPreferredTryMasters(project, change): # pragma: no cover | |
| 393 import json | |
| 394 import os.path | |
| 395 import platform | |
| 396 import subprocess | |
| 397 cq_config_path = os.path.join( | |
| 398 change.RepositoryRoot(), 'config', 'cq.cfg') | |
| 399 # commit_queue.py below is a script in depot_tools directory, which has a | |
| 400 # 'builders' command to retrieve a list of CQ builders from the CQ config. | |
| 401 is_win = platform.system() == 'Windows' | |
| 402 masters = json.loads(subprocess.check_output( | |
| 403 ['commit_queue', 'builders', cq_config_path], shell=is_win)) | |
| 404 try_config = {} | |
| 405 for master in masters: | |
| 406 try_config.setdefault(master, {}) | |
| 407 for builder in masters[master]: | |
| 408 # Do not trigger presubmit builders, since they're likely to fail | |
| 409 # (e.g. OWNERS checks before finished code review), and we're | |
| 410 # running local presubmit anyway. | |
| 411 if 'presubmit' not in builder.lower(): | |
| 412 try_config[master][builder] = ['defaulttests'] | |
| 413 return try_config | |
| OLD | NEW |