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

Unified Diff: git_cl.py

Issue 2147563003: git cl try: Trigger CQ Dry Run by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Explain what happened on success. Created 4 years, 5 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 | tests/git_cl_test.py » ('j') | 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 07f7c8bd6f85e81a31400d30d69c733334b565bc..7b88a6dcd6562ce701bb6ce15859e591dd9349d3 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4550,28 +4550,8 @@ def CMDtry(parser, args):
options.verbose,
sys.stdout)
- if not options.bot:
- # Get try masters from cq.cfg if any.
- # TODO(tandrii): some (but very few) projects store cq.cfg in different
- # location.
- cq_cfg = os.path.join(change.RepositoryRoot(),
- 'infra', 'config', 'cq.cfg')
- if os.path.exists(cq_cfg):
- masters = {}
- cq_masters = commit_queue.get_master_builder_map(
- cq_cfg, include_experimental=False, include_triggered=False)
- for master, builders in cq_masters.iteritems():
- for builder in builders:
- # Skip presubmit builders, because these will fail without LGTM.
- masters.setdefault(master, {})[builder] = ['defaulttests']
- if masters:
- print('Loaded default bots from CQ config (%s)' % cq_cfg)
- return masters
- else:
- print('CQ config exists (%s) but has no try bots listed' % cq_cfg)
-
if not options.bot:
- parser.error('No default try builder to try, use --bot')
+ return {}
builders_and_tests = {}
# TODO(machenbach): The old style command-line options don't support
@@ -4596,6 +4576,28 @@ def CMDtry(parser, args):
return {options.master: builders_and_tests}
masters = GetMasterMap()
+ if not masters:
+ # Default to triggering Dry Run (see http://crbug.com/625697).
+ if options.verbose:
+ print('git cl try with no bots now defaults to CQ Dry Run.')
+ try:
+ cl.SetCQState(_CQState.DRY_RUN)
+ print('scheduled CQ Dry Run on %s' % cl.GetIssueURL())
+ return 0
+ except KeyboardInterrupt:
+ raise
+ except:
Paweł Hajdan Jr. 2016/07/13 09:55:46 I'd usually catch Exception here, with no need the
tandrii(chromium) 2016/07/13 09:57:51 the purpose of explicitly mentioning Keyboard inte
+ print('WARNING: failed to trigger CQ Dry Run.\n'
+ 'Either:\n'
+ ' * your project has no CQ\n'
+ ' * you don\'t have permission to trigger Dry Run\n'
+ ' * bug in this code (see stack trace below).\n'
+ 'Consider specifying which bots to trigger manually '
+ 'or asking your project owners for permissions '
+ 'or contacting Chrome Infrastructure team at '
+ 'https://www.chromium.org/infra\n\n')
+ # Still raise exception so that stack trace is printed.
+ raise
for builders in masters.itervalues():
if any('triggered' in b for b in builders):
@@ -4749,7 +4751,7 @@ def CMDset_commit(parser, args):
state = _CQState.COMMIT
if not cl.GetIssue():
parser.error('Must upload the issue first')
- cl._codereview_impl.SetCQState(state)
+ cl.SetCQState(state)
return 0
« no previous file with comments | « no previous file | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698