Commit 44e01ff3 authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

[git-cl-try] accept buckets from builders-map app

Context:
https://bugs.chromium.org/p/chromium/issues/detail?id=800355#c22

Prepare git-cl-try to a new format of builders-map.appspot.com response
where each entry contains buckets, as opposed to masters.

Bug: 800355
Change-Id: I5a90c6c4860a7e1fca843067c477a272d782cba1
Reviewed-on: https://chromium-review.googlesource.com/885100
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent fd4ad241
......@@ -458,14 +458,19 @@ def _get_bucket_map_for_builders(builders):
bucket_map = {}
for builder in builders:
masters = builders_map.get(builder, [])
if not masters:
return None, ('No matching master for builder %s.' % builder)
if len(masters) > 1:
return None, ('The builder name %s exists in multiple masters %s.' %
(builder, masters))
bucket = _prefix_master(masters[0])
bucket_map.setdefault(bucket, {})[builder] = []
builder_info = builders_map.get(builder, {})
if isinstance(builder_info, list):
# This is a list of masters, legacy mode.
# TODO(nodir): remove this code path.
buckets = map(_prefix_master, builder_info)
else:
buckets = builder_info.get('buckets') or []
if not buckets:
return None, ('No matching bucket for builder %s.' % builder)
if len(buckets) > 1:
return None, ('The builder name %s exists in multiple buckets %s.' %
(builder, buckets))
bucket_map.setdefault(buckets[0], {})[builder] = []
return bucket_map, None
......
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