Revert "[Fixed from older branch] Timing/RDB for lower-level checks"
This reverts commit dba1d65a1999dc08fc68bd734fa414ecd4fe27bd.
Reason for revert: "Check* takes exactly 3 arguments (2 given)" presubmit errors
eg: https://ci.chromium.org/p/chromium/builders/try/chromium_presubmit/933062?
https://crbug.com/1113506
Original change's description:
> [Fixed from older branch] Timing/RDB for lower-level checks
>
> presubmit: Report timing to rdb for individual checks
> Rather than using CheckChangeOnCommit() or CheckChangeOnUpload() as the
> sole entry points for PRESUBMIT.py files, this cl enables presubmit_support.py
> to use any CheckXYZ[OnCommit/Upload] function to serve as an entry point.
>
> This way, we can perform timing and RDB reporting for each of the
> presubmit check functions and have check-specific data.
>
> Bug: 1106943
> Change-Id: Ifdabd68c0904a6d70a828f12de157369c6c1571d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2332321
> Commit-Queue: Saagar Sanghavi <saagarsanghavi@google.com>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
TBR=dpranke@google.com,estaab@chromium.org,ehmaldonado@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,saagarsanghavi@google.com
Change-Id: Ibd80f70661d2196f903f0c6b79eb74eda6c94d44
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1106943, 1113506
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2340692
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 09496db..3878b96 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1273,7 +1273,7 @@
return args
def RunHook(self, committing, may_prompt, verbose, parallel, upstream,
- description, all_files, resultdb=False, realm=None):
+ description, all_files, resultdb=False):
"""Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
args = self._GetCommonPresubmitArgs(verbose, upstream)
args.append('--commit' if committing else '--upload')
@@ -1292,15 +1292,10 @@
args.extend(['--description_file', description_file])
start = time_time()
+
cmd = ['vpython', PRESUBMIT_SUPPORT] + args
- if resultdb and realm:
- cmd = ['rdb', 'stream', '-new', '-realm', realm] + cmd
- elif resultdb:
- # TODO (crbug.com/1113463): store realm somewhere and look it up so
- # it is not required to pass the realm flag
- print('Note: ResultDB reporting will NOT be performed because --realm'
- ' was not specified. To enable ResultDB, please run the command'
- ' again with the --realm argument to specify the LUCI realm.')
+ if resultdb:
+ cmd = ['rdb', 'stream', '-new'] + cmd
p = subprocess2.Popen(cmd)
exit_code = p.wait()
@@ -1418,8 +1413,7 @@
upstream=base_branch,
description=change_desc.description,
all_files=False,
- resultdb=options.resultdb,
- realm=options.realm)
+ resultdb=options.resultdb)
self.ExtendCC(hook_results['more_cc'])
print_stats(git_diff_args)
@@ -1870,7 +1864,7 @@
detail = self._GetChangeDetail(['LABELS'])
return u'Commit-Queue' in detail.get('labels', {})
- def CMDLand(self, force, bypass_hooks, verbose, parallel, resultdb, realm):
+ def CMDLand(self, force, bypass_hooks, verbose, parallel):
if git_common.is_dirty_git_tree('land'):
return 1
@@ -1911,8 +1905,7 @@
upstream=upstream,
description=description,
all_files=False,
- resultdb=resultdb,
- realm=realm)
+ resultdb=False)
self.SubmitIssue(wait_for_merge=True)
print('Issue %s has been submitted.' % self.GetIssueURL())
@@ -3838,7 +3831,6 @@
parser.add_option('--resultdb', action='store_true',
help='Run presubmit checks in the ResultSink environment '
'and send results to the ResultDB database.')
- parser.add_option('--realm', help='LUCI realm if reporting to ResultDB')
options, args = parser.parse_args(args)
if not options.force and git_common.is_dirty_git_tree('presubmit'):
@@ -3865,8 +3857,7 @@
upstream=base_branch,
description=description,
all_files=options.all,
- resultdb=options.resultdb,
- realm=options.realm)
+ resultdb=options.resultdb)
return 0
@@ -4080,7 +4071,6 @@
parser.add_option('--resultdb', action='store_true',
help='Run presubmit checks in the ResultSink environment '
'and send results to the ResultDB database.')
- parser.add_option('--realm', help='LUCI realm if reporting to ResultDB')
orig_args = args
(options, args) = parser.parse_args(args)
@@ -4227,10 +4217,6 @@
parser.add_option('--parallel', action='store_true',
help='Run all tests specified by input_api.RunTests in all '
'PRESUBMIT files in parallel.')
- parser.add_option('--resultdb', action='store_true',
- help='Run presubmit checks in the ResultSink environment '
- 'and send results to the ResultDB database.')
- parser.add_option('--realm', help='LUCI realm if reporting to ResultDB')
(options, args) = parser.parse_args(args)
cl = Changelist()
@@ -4239,8 +4225,8 @@
DieWithError('You must upload the change first to Gerrit.\n'
' If you would rather have `git cl land` upload '
'automatically for you, see http://crbug.com/642759')
- return cl.CMDLand(options.force, options.bypass_hooks, options.verbose,
- options.parallel, options.resultdb, options.realm)
+ return cl.CMDLand(options.force, options.bypass_hooks,
+ options.verbose, options.parallel)
@subcommand.usage('<patch url or issue id or issue url>')