Revert "Upload metrics from test runner"

This reverts commit 075194b05563c628575b8770f6206f42a7065a02.

Reason for revert: upload metrics failure.

Original change's description:
> Upload metrics from test runner
>
> DeviceLab test metrics have been uploaded to metrics center by calling cocoon from test runner. Since metrics center migration has been finished, this CL starts uploading metrics from test runner. Related test runner PR: https://github.com/flutter/flutter/pull/88447
>
> Change-Id: Idf2de0052420fef4844222d7232ebe3d523fdb76
> Bug: https://github.com/flutter/flutter/issues/88296
> Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/17200
> Commit-Queue: Keyong Han <keyonghan@google.com>
> Reviewed-by: Casey Hillers <chillers@google.com>

TBR=godofredoc@google.com,keyonghan@google.com,chillers@google.com,flutter-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ibf747eb51c55ef387c244deeef664ad2ed85b239
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/flutter/flutter/issues/88296
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/17320
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
diff --git a/recipes/devicelab/devicelab_drone.expected/basic.json b/recipes/devicelab/devicelab_drone.expected/basic.json
index d96a541..0116e98 100644
--- a/recipes/devicelab/devicelab_drone.expected/basic.json
+++ b/recipes/devicelab/devicelab_drone.expected/basic.json
@@ -110,17 +110,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
diff --git a/recipes/devicelab/devicelab_drone.expected/local-engine.json b/recipes/devicelab/devicelab_drone.expected/local-engine.json
index 29ba684..9e45a30 100644
--- a/recipes/devicelab/devicelab_drone.expected/local-engine.json
+++ b/recipes/devicelab/devicelab_drone.expected/local-engine.json
@@ -110,17 +110,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -762,8 +751,6 @@
     "cmd": [
       "luci-auth",
       "token",
-      "-scopes",
-      "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore",
       "-lifetime",
       "3m"
     ],
@@ -853,25 +840,19 @@
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
       "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
-      "GCP_PROJECT": "flutter-infra",
       "LOCAL_ENGINE": "[CLEANUP]/builder/src/out/host-release",
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
-      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-      "TOKEN_PATH": "[CLEANUP]/tmp_tmp_3"
+      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk"
     },
     "env_prefixes": {
       "PATH": [
         "[CLEANUP]/builder/src/out/host-release/dart-sdk/bin",
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
-        "[CLEANUP]/tmp_tmp_2/vpython",
-        "[CLEANUP]/builder/src/out/host-release/dart-sdk/bin",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
         "[CLEANUP]/tmp_tmp_2/vpython"
       ]
     },
diff --git a/recipes/devicelab/devicelab_drone.expected/no-task-name.json b/recipes/devicelab/devicelab_drone.expected/no-task-name.json
index 7c022e7..286b5f6 100644
--- a/recipes/devicelab/devicelab_drone.expected/no-task-name.json
+++ b/recipes/devicelab/devicelab_drone.expected/no-task-name.json
@@ -7,7 +7,7 @@
       "The recipe has crashed at point 'Uncaught exception'!",
       "",
       "Traceback (most recent call last):",
-      "  File \"RECIPE_REPO[flutter]/recipes/devicelab/devicelab_drone.py\", line 39, in RunSteps",
+      "  File \"RECIPE_REPO[flutter]/recipes/devicelab/devicelab_drone.py\", line 38, in RunSteps",
       "    raise ValueError('A task_name property is required')",
       "ValueError: A task_name property is required"
     ]
diff --git a/recipes/devicelab/devicelab_drone.expected/post-submit.json b/recipes/devicelab/devicelab_drone.expected/post-submit.json
index e0faedf..4f91cd8 100644
--- a/recipes/devicelab/devicelab_drone.expected/post-submit.json
+++ b/recipes/devicelab/devicelab_drone.expected/post-submit.json
@@ -118,17 +118,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]\\tmp_tmp_1\\flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -650,8 +639,6 @@
     "cmd": [
       "luci-auth",
       "token",
-      "-scopes",
-      "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore",
       "-lifetime",
       "3m"
     ],
@@ -725,8 +712,6 @@
       "True",
       "--results-file",
       "[CLEANUP]\\results_tmp_1\\results",
-      "--commit-time",
-      "",
       "--service-account-token-file",
       "[CLEANUP]\\tmp_tmp_3"
     ],
@@ -735,22 +720,17 @@
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "FLUTTER_LOGS_DIR": "[CLEANUP]\\flutter_logs_dir",
       "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]\\flutter_logs_dir",
-      "GCP_PROJECT": "flutter-infra",
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
       "OS": "win",
       "PUB_CACHE": "[START_DIR]\\.pub-cache",
-      "SDK_CHECKOUT_PATH": "[CLEANUP]\\tmp_tmp_1\\flutter sdk",
-      "TOKEN_PATH": "[CLEANUP]\\tmp_tmp_3"
+      "SDK_CHECKOUT_PATH": "[CLEANUP]\\tmp_tmp_1\\flutter sdk"
     },
     "env_prefixes": {
       "PATH": [
         "[CLEANUP]\\tmp_tmp_1\\flutter sdk\\bin",
         "[CLEANUP]\\tmp_tmp_1\\flutter sdk\\bin\\cache\\dart-sdk\\bin",
-        "[CLEANUP]\\tmp_tmp_2\\vpython",
-        "[CLEANUP]\\tmp_tmp_1\\flutter sdk\\bin",
-        "[CLEANUP]\\tmp_tmp_1\\flutter sdk\\bin\\cache\\dart-sdk\\bin",
         "[CLEANUP]\\tmp_tmp_2\\vpython"
       ]
     },
diff --git a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
index cfed665..c2411ca 100644
--- a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
+++ b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
@@ -110,17 +110,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -660,8 +649,6 @@
     "cmd": [
       "luci-auth",
       "token",
-      "-scopes",
-      "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore",
       "-lifetime",
       "3m"
     ],
@@ -735,8 +722,6 @@
       "False",
       "--results-file",
       "[CLEANUP]/results_tmp_1/results",
-      "--commit-time",
-      "",
       "--service-account-token-file",
       "[CLEANUP]/tmp_tmp_3"
     ],
@@ -745,22 +730,17 @@
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
       "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
-      "GCP_PROJECT": "flutter-infra",
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
-      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-      "TOKEN_PATH": "[CLEANUP]/tmp_tmp_3"
+      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk"
     },
     "env_prefixes": {
       "PATH": [
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
-        "[CLEANUP]/tmp_tmp_2/vpython",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
         "[CLEANUP]/tmp_tmp_2/vpython"
       ]
     },
diff --git a/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json b/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
index 427587d..b5f1d8d 100644
--- a/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
+++ b/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
@@ -110,17 +110,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -660,8 +649,6 @@
     "cmd": [
       "luci-auth",
       "token",
-      "-scopes",
-      "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore",
       "-lifetime",
       "3m"
     ],
@@ -747,22 +734,17 @@
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
       "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
-      "GCP_PROJECT": "flutter-infra",
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
-      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-      "TOKEN_PATH": "[CLEANUP]/tmp_tmp_3"
+      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk"
     },
     "env_prefixes": {
       "PATH": [
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
-        "[CLEANUP]/tmp_tmp_2/vpython",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
         "[CLEANUP]/tmp_tmp_2/vpython"
       ]
     },
diff --git a/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json b/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
index f823354..4da7978 100644
--- a/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
+++ b/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
@@ -110,17 +110,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "name": "git commit time"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -692,8 +681,6 @@
     "cmd": [
       "luci-auth",
       "token",
-      "-scopes",
-      "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore",
       "-lifetime",
       "3m"
     ],
@@ -779,22 +766,17 @@
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
       "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
-      "GCP_PROJECT": "flutter-infra",
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
-      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-      "TOKEN_PATH": "[CLEANUP]/tmp_tmp_3"
+      "SDK_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_1/flutter sdk"
     },
     "env_prefixes": {
       "PATH": [
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
         "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
-        "[CLEANUP]/tmp_tmp_2/vpython",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin",
-        "[CLEANUP]/tmp_tmp_1/flutter sdk/bin/cache/dart-sdk/bin",
         "[CLEANUP]/tmp_tmp_2/vpython"
       ]
     },
diff --git a/recipes/devicelab/devicelab_drone.py b/recipes/devicelab/devicelab_drone.py
index e654c5a..fb6147c 100644
--- a/recipes/devicelab/devicelab_drone.py
+++ b/recipes/devicelab/devicelab_drone.py
@@ -5,7 +5,6 @@
 from recipe_engine.recipe_api import Property
 
 DEPS = [
-    'fuchsia/git',
     'flutter/bucket_util',
     'flutter/devicelab_osx_sdk',
     'flutter/flutter_deps',
@@ -47,15 +46,6 @@
       api.properties.get('git_url'),
       api.properties.get('git_ref'),
   )
-  with api.context(cwd=flutter_path):
-    commit_time = api.git(
-        'git commit time',
-        'log',
-        '--pretty=format:%ct',
-        '-n',
-        '1',
-        stdout=api.raw_io.output()
-    ).stdout.rstrip()
   env, env_prefixes = api.repo_util.flutter_environment(flutter_path)
   api.logs_util.initialize_logs_collection(env)
   with api.step.nest('Dependencies'):
@@ -127,8 +117,8 @@
           check_flaky(api)
   with api.context(env=env, env_prefixes=env_prefixes, cwd=devicelab_path):
     uploadResults(
-        api, env, env_prefixes, results_path, test_status == 'flaky',
-        git_branch, api.properties.get('buildername'), commit_time
+        api, results_path, test_status == 'flaky', git_branch,
+        api.properties.get('buildername')
     )
     uploadMetricsToCas(api, results_path)
 
@@ -188,8 +178,7 @@
   """
   supported_branches = ['master']
   if api.runtime.is_experimental or api.properties.get(
-      'git_url'
-  ) or 'staging' in builder_name or git_branch not in supported_branches:
+      'git_url') or 'staging' in builder_name or git_branch not in supported_branches:
     return True
   else:
     return False
@@ -197,14 +186,11 @@
 
 def uploadResults(
     api,
-    env,
-    env_prefixes,
     results_path,
     is_test_flaky,
     git_branch,
     builder_name,
-    commit_time,
-    test_status='Succeeded',
+    test_status='Succeeded'
 ):
   """Upload DeviceLab test results to Cocoon.
 
@@ -224,29 +210,18 @@
         '--test-status', test_status
     ])
   else:
-    runner_params.extend([
-        '--results-file', results_path, '--commit-time', commit_time
-    ])
-
+    runner_params.extend(['--results-file', results_path])
   with api.step.nest('Upload metrics'):
     service_account = api.service_account.default()
-    access_token = service_account.get_access_token(
-        scopes=[
-            'https://www.googleapis.com/auth/cloud-platform',
-            'https://www.googleapis.com/auth/datastore'
-        ]
-    )
+    access_token = service_account.get_access_token()
     access_token_path = api.path.mkstemp()
     api.file.write_text(
         "write token", access_token_path, access_token, include_log=False
     )
-    env['TOKEN_PATH'] = access_token_path
-    env['GCP_PROJECT'] = 'flutter-infra'
     runner_params.extend(['--service-account-token-file', access_token_path])
     upload_command = ['dart', 'bin/test_runner.dart', 'upload-metrics']
     upload_command.extend(runner_params)
-    with api.context(env=env, env_prefixes=env_prefixes):
-      api.step('upload results', upload_command, infra_step=True)
+    api.step('upload results', upload_command, infra_step=True)
 
 
 def uploadMetricsToCas(api, results_path):
@@ -292,7 +267,9 @@
           task_name='abc',
           dependencies=[{'dependency': 'xcode'}]
       ), api.repo_util.flutter_environment_data(checkout_dir=checkout_path),
-      api.buildbucket.ci_build(git_ref='refs/heads/master',),
+      api.buildbucket.ci_build(
+          git_ref='refs/heads/master',
+      ),
       api.step_data(
           'run abc',
           stdout=api.raw_io.output_text('#flaky\nthis is a flaky\nflaky: true'),
@@ -306,7 +283,9 @@
           task_name='abc',
           dependencies=[{'dependency': 'xcode'}]
       ),
-      api.buildbucket.ci_build(git_ref='refs/heads/master',),
+      api.buildbucket.ci_build(
+          git_ref='refs/heads/master',
+      ),
       api.repo_util.flutter_environment_data(checkout_dir=checkout_path),
   )
   yield api.test(
@@ -320,7 +299,9 @@
           stdout=api.raw_io.output_text('#flaky\nthis is a flaky\nflaky: true'),
           retcode=0
       ),
-      api.buildbucket.ci_build(git_ref='refs/heads/master',),
+      api.buildbucket.ci_build(
+          git_ref='refs/heads/master',
+      ),
       api.platform.name('win'),
   )
   yield api.test(
@@ -332,7 +313,9 @@
           upload_metrics=True,
           upload_metrics_to_cas=True,
       ), api.repo_util.flutter_environment_data(checkout_dir=checkout_path),
-      api.buildbucket.ci_build(git_ref='refs/heads/master',)
+      api.buildbucket.ci_build(
+          git_ref='refs/heads/master',
+      )
   )
   yield api.test(
       "local-engine",
diff --git a/recipes/engine/engine_metrics.expected/basic.json b/recipes/engine/engine_metrics.expected/basic.json
index 711a4f4..26c461d 100644
--- a/recipes/engine/engine_metrics.expected/basic.json
+++ b/recipes/engine/engine_metrics.expected/basic.json
@@ -715,7 +715,7 @@
     "env": {
       "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
       "FLUTTER_PREBUILT_DART_SDK": "True",
-      "GCP_PROJECT": "flutter-infra",
+      "GCP_PROJECT": "flutter-cirrus",
       "TOKEN_PATH": "[CLEANUP]/tmp_tmp_1"
     },
     "env_prefixes": {
diff --git a/recipes/engine/engine_metrics.py b/recipes/engine/engine_metrics.py
index 16cb8a4..494155f 100644
--- a/recipes/engine/engine_metrics.py
+++ b/recipes/engine/engine_metrics.py
@@ -73,7 +73,7 @@
       'write token', access_token_path, access_token, include_log=False
   )
   env['TOKEN_PATH'] = access_token_path
-  env['GCP_PROJECT'] = 'flutter-infra'
+  env['GCP_PROJECT'] = 'flutter-cirrus'
   with api.context(env=env, env_prefixes=env_prefixes, cwd=benchmark_path):
     api.step('Upload metrics', ['bash', script_path])