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

Unified Diff: commit_queue.py

Issue 1153333003: Added tools to retrieve CQ builders from a CQ config (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Addressed comments 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 | third_party/cq_client/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: commit_queue.py
diff --git a/commit_queue.py b/commit_queue.py
index 99eea34ec01579c48276078f134faf232a234a99..2bcd841fa44d08858f69467354af77576217597c 100755
--- a/commit_queue.py
+++ b/commit_queue.py
@@ -9,6 +9,7 @@
__version__ = '0.1'
import functools
+import json
import logging
import optparse
import os
@@ -21,6 +22,11 @@ import auth
import fix_encoding
import rietveld
+THIRD_PARTY_DIR = os.path.join(os.path.dirname(__file__), 'third_party')
+sys.path.append(THIRD_PARTY_DIR)
+
+from cq_client import cq_pb2
+from google.protobuf import text_format
def usage(more):
def hook(fn):
@@ -102,6 +108,46 @@ def CMDclear(parser, args):
return set_commit(obj, options.issue, '0')
+def CMDbuilders(parser, args):
+ """Prints json-formatted list of builders given a path to cq.cfg file.
+
+ The output is a dictionary in the following format:
+ {
+ 'master_name': {
+ 'builder_name': {
+ 'custom_property': 'value',
+ 'testfilter': 'compile'
+ },
+ 'another_builder': {}
+ },
+ 'another_master': {
+ 'third_builder': {}
+ }
+ }
+ """
+ _, args = parser.parse_args(args)
+ if len(args) != 1:
+ parser.error('Expected a single path to CQ config. Got: %s' %
+ ' '.join(args))
+
+ with open(args[0]) as config_file:
+ cq_config = config_file.read()
+
+ config = cq_pb2.Config()
+ text_format.Merge(cq_config, config)
+ masters = {}
+ if config.HasField('verifiers') and config.verifiers.HasField('try_job'):
+ for bucket in config.verifiers.try_job.buckets:
+ masters.setdefault(bucket.name, {})
+ for builder in bucket.builders:
+ if not builder.HasField('experiment_percentage'):
+ masters[bucket.name].setdefault(builder.name, {})
+ for prop in builder.properties:
+ masters[bucket.name][builder.name][prop.name] = prop.value
+ print json.dumps(masters)
+
+CMDbuilders.func_usage_more = '<path-to-cq-config>'
+
###############################################################################
## Boilerplate code
« no previous file with comments | « no previous file | third_party/cq_client/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698