Commit d5ca7596 authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Add a flag for the location of the LUCI configuration files.

In order to generate internal testing JSON files, the configuration
files must be read from src-internal rather than src or all of the
builders will be flagged as unknown.

Bug: 1078933
Change-Id: Ic659675778256c7fb2e2df5409dbc35e72ff3b46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186451
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: default avatarStephen Martinis <martiniss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766448}
parent f5fb7c8e
...@@ -12,6 +12,7 @@ import ast ...@@ -12,6 +12,7 @@ import ast
import collections import collections
import copy import copy
import difflib import difflib
import glob
import itertools import itertools
import json import json
import os import os
...@@ -1291,19 +1292,12 @@ class BBJSONGenerator(object): ...@@ -1291,19 +1292,12 @@ class BBJSONGenerator(object):
# their presubmit to run `generate_buildbot_json.py -c`, so that the tree # their presubmit to run `generate_buildbot_json.py -c`, so that the tree
# never ends up in an invalid state. # never ends up in an invalid state.
bot_names = set() bot_names = set()
infra_config_dir = os.path.abspath( milo_configs = glob.glob(
os.path.join(os.path.dirname(__file__), os.path.join(self.args.infra_config_dir, 'generated', 'luci-milo*.cfg'))
'..', '..', 'infra', 'config'))
milo_configs = [
os.path.join(infra_config_dir, 'generated', 'luci-milo.cfg'),
os.path.join(infra_config_dir, 'generated', 'luci-milo-dev.cfg'),
]
for c in milo_configs: for c in milo_configs:
for l in self.read_file(c).splitlines(): for l in self.read_file(c).splitlines():
if (not 'name: "buildbucket/luci.chromium.' in l and if (not 'name: "buildbucket/luci.chromium.' in l and
not 'name: "buildbucket/luci.chrome.' in l and not 'name: "buildbucket/luci.chrome.' in l):
not 'name: "buildbot/chromium.' in l and
not 'name: "buildbot/tryserver.chromium.' in l):
continue continue
# l looks like # l looks like
# `name: "buildbucket/luci.chromium.try/win_chromium_dbg_ng"` # `name: "buildbucket/luci.chromium.try/win_chromium_dbg_ng"`
...@@ -1824,9 +1818,16 @@ class BBJSONGenerator(object): ...@@ -1824,9 +1818,16 @@ class BBJSONGenerator(object):
"Examples:\n" + "Examples:\n" +
" Outputs file into specified json file: \n" + " Outputs file into specified json file: \n" +
" --json <file-name-here.json>")) " --json <file-name-here.json>"))
parser.add_argument(
'--infra-config-dir',
help='Path to the LUCI services configuration directory',
default=os.path.abspath(
os.path.join(os.path.dirname(__file__),
'..', '..', 'infra', 'config')))
self.args = parser.parse_args(argv) self.args = parser.parse_args(argv)
if self.args.json and not self.args.query: if self.args.json and not self.args.query:
parser.error("The --json flag can only be used with --query.") parser.error("The --json flag can only be used with --query.")
self.args.infra_config_dir = os.path.abspath(self.args.infra_config_dir)
def does_test_match(self, test_info, params_dict): def does_test_match(self, test_info, params_dict):
"""Checks to see if the test matches the parameters given. """Checks to see if the test matches the parameters given.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment