Skip to content

Commit

Permalink
Use script in depot_tools to retrieve builders from new cq.cfg
Browse files Browse the repository at this point in the history
R=pgervais@chromium.org
TEST=ran git-cl-try on this CL

Review URL: https://codereview.chromium.org/1152823005

Cr-Commit-Position: refs/heads/master@{#332200}
  • Loading branch information
rryk authored and Commit bot committed Jun 1, 2015
1 parent c273125 commit 87e80c7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 134 deletions.
49 changes: 24 additions & 25 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions testing/commit_queue/OWNERS

This file was deleted.

102 changes: 0 additions & 102 deletions testing/commit_queue/config.json

This file was deleted.

0 comments on commit 87e80c7

Please sign in to comment.