Fixes for presubmit recipe

- Add depot_tools to PATH
- Run on a branch
- Use max verbosity

BUG=skia:5823
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2394853002

Review-Url: https://codereview.chromium.org/2394853002
diff --git a/infra/bots/recipes/swarm_presubmit.expected/presubmit.json b/infra/bots/recipes/swarm_presubmit.expected/presubmit.json
index cf33cf6..6eb6013 100644
--- a/infra/bots/recipes/swarm_presubmit.expected/presubmit.json
+++ b/infra/bots/recipes/swarm_presubmit.expected/presubmit.json
@@ -122,14 +122,66 @@
   {
     "cmd": [
       "git",
-      "cl",
-      "presubmit",
-      "--force"
+      "checkout",
+      "-b",
+      "tmp_00000000-0000-0000-0000-000000000000"
     ],
     "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "name": "create git branch"
+  },
+  {
+    "cmd": [
+      "git",
+      "status"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "name": "git status"
+  },
+  {
+    "cmd": [
+      "git",
+      "cl",
+      "presubmit",
+      "--force",
+      "-v",
+      "-v"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "env": {
+      "PATH": "RECIPE_PACKAGE_REPO[depot_tools]:%(PATH)s"
+    },
     "name": "presubmit"
   },
   {
+    "cmd": [
+      "git",
+      "reset",
+      "--hard",
+      "origin/master"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "name": "git reset"
+  },
+  {
+    "cmd": [
+      "git",
+      "checkout",
+      "origin/master"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "name": "checkout origin/master"
+  },
+  {
+    "cmd": [
+      "git",
+      "branch",
+      "-D",
+      "tmp_00000000-0000-0000-0000-000000000000"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "name": "delete git branch"
+  },
+  {
     "name": "$result",
     "recipe_result": null,
     "status_code": 0
diff --git a/infra/bots/recipes/swarm_presubmit.py b/infra/bots/recipes/swarm_presubmit.py
index 30155a2..ad48025 100644
--- a/infra/bots/recipes/swarm_presubmit.py
+++ b/infra/bots/recipes/swarm_presubmit.py
@@ -8,8 +8,11 @@
 
 DEPS = [
   'core',
+  'depot_tools/depot_tools',
+  'recipe_engine/path',
   'recipe_engine/properties',
   'recipe_engine/step',
+  'recipe_engine/uuid',
   'vars',
 ]
 
@@ -17,9 +20,34 @@
 def RunSteps(api):
   api.vars.setup()
   api.core.checkout_steps()
-  api.step('presubmit',
-           cmd=['git', 'cl', 'presubmit', '--force'],
+
+  # git-cl wants us to be on a branch.
+  branch = 'tmp_%s' % api.uuid.random()
+  api.step('create git branch',
+           cmd=['git', 'checkout', '-b', branch],
            cwd=api.vars.skia_dir)
+  try:
+    api.step('git status',
+             cmd=['git', 'status'],
+             cwd=api.vars.skia_dir)
+
+    depot_tools_path = api.depot_tools.package_repo_resource()
+    env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])}
+    api.step('presubmit',
+             cmd=['git', 'cl', 'presubmit', '--force', '-v', '-v'],
+             cwd=api.vars.skia_dir,
+             env=env)
+  finally:
+    api.step('git reset',
+             cmd=['git', 'reset', '--hard', 'origin/master'],
+             cwd=api.vars.skia_dir)
+    api.step('checkout origin/master',
+             cmd=['git', 'checkout', 'origin/master'],
+             cwd=api.vars.skia_dir)
+    api.step('delete git branch',
+             cmd=['git', 'branch', '-D', branch],
+             cwd=api.vars.skia_dir)
+             
 
 
 def GenTests(api):
diff --git a/infra/bots/recipes/swarm_trigger.py b/infra/bots/recipes/swarm_trigger.py
index ed4aad6..3caa9d1 100644
--- a/infra/bots/recipes/swarm_trigger.py
+++ b/infra/bots/recipes/swarm_trigger.py
@@ -15,9 +15,7 @@
   'build/gsutil',
   'builder_name_schema',
   'core',
-  'depot_tools/depot_tools',
   'depot_tools/git',
-  'depot_tools/tryserver',
   'recipe_engine/json',
   'recipe_engine/path',
   'recipe_engine/properties',