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

Unified Diff: git_cl.py

Issue 447363002: Auto find tryserver master for git cl try (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 77f4a9e9f13c769e02e6acdadb087acb64f05224..80e4101833053af3b281b99be6c5535669392b52 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2208,6 +2208,45 @@ def GetTreeStatusReason():
return status['message']
+def GetBuilderMaster(bot_list):
+ """For a given builder, fetch the master from AE if available."""
+ err_msg = ''
M-A Ruel 2014/08/14 19:59:38 remove
sheyang 2014/08/14 20:45:09 Done.
+ master_map = None
M-A Ruel 2014/08/14 19:59:38 Remove
sheyang 2014/08/14 20:45:09 Done.
+ result_master = ''
M-A Ruel 2014/08/14 19:59:38 Move to line 2229
sheyang 2014/08/14 20:45:08 Done.
+ map_url = 'https://builders-map.appspot.com/'
+ try:
+ master_map = json.load(urllib2.urlopen(map_url))
+ except urllib2.URLError as e:
+ err_msg = ('Failed to fetch builder-to-master map from %s. Error: %s.' %
M-A Ruel 2014/08/14 19:59:38 return None, ('...
sheyang 2014/08/14 20:45:09 Do you want to get rid of the err_msg variable?
M-A Ruel 2014/08/14 20:47:37 Exact, it serves no purpose.
+ (map_url, e))
+ return None, err_msg
+ except ValueError as e:
+ err_msg = 'Invalid json string from %s. Error: %s.' % (map_url, e)
M-A Ruel 2014/08/14 19:59:38 return None, '... and for the lines below.
+ return None, err_msg
+
+ if not master_map:
+ return None, err_msg
+
+ for bot in bot_list:
+ builder = bot.split(':', 1)[0]
+ master_list = master_map.get(builder, [])
+ if not master_list:
+ err_msg = 'No matching master for builder %s.' % builder
+ return None, err_msg
+ elif len(master_list) > 1:
+ err_msg = ('The builder name %s exists in multiple masters %s.' %
+ (builder, master_list))
+ return None, err_msg
+ else:
+ cur_master = master_list[0]
+ if not result_master:
+ result_master = cur_master
+ elif result_master != cur_master:
+ err_msg = 'The builders do not belong to the same master.'
+ return None, err_msg
+ return result_master, err_msg
M-A Ruel 2014/08/14 19:59:38 return result_master, None
sheyang 2014/08/14 20:45:09 Done.
+
+
def CMDtree(parser, args):
"""Shows the status of the tree."""
_, args = parser.parse_args(args)
@@ -2231,10 +2270,10 @@ def CMDtry(parser, args):
"-b", "--bot", action="append",
help=("IMPORTANT: specify ONE builder per --bot flag. Use it multiple "
"times to specify multiple builders. ex: "
- "'-bwin_rel:ui_tests,webkit_unit_tests -bwin_layout'. See "
+ "'-b win_rel:ui_tests,webkit_unit_tests -b win_layout'. See "
"the try server waterfall for the builders name and the tests "
"available. Can also be used to specify gtest_filter, e.g. "
- "-bwin_rel:base_unittests:ValuesTest.*Value"))
+ "-b win_rel:base_unittests:ValuesTest.*Value"))
group.add_option(
"-m", "--master", default='',
help=("Specify a try master where to run the tries."))
@@ -2276,8 +2315,11 @@ def CMDtry(parser, args):
options.name = cl.GetBranch()
if options.bot and not options.master:
- parser.error('For manually specified bots please also specify the '
- 'tryserver master, e.g. "-m tryserver.chromium.linux".')
+ options.master, err_msg = GetBuilderMaster(options.bot)
+ if err_msg:
+ parser.error('Tryserver master cannot be found because: %s\n'
+ 'Please manually specify the tryserver master'
+ ', e.g. "-m tryserver.chromium.linux".' % err_msg)
def GetMasterMap():
# Process --bot and --testfilter.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698