[run_script] Remove unused properties

The "repo" and "ref" properties can generally be retrieved from the
buildbucket input, so it's unnecessary to let them be specified as
properties as well.

Change-Id: I63bb3fda7f186558e594b3a852caeb33be9e4d7e
diff --git a/recipes/run_script.expected/no_repo_specified.json b/recipes/run_script.expected/no_buildbucket_input.json
similarity index 66%
rename from recipes/run_script.expected/no_repo_specified.json
rename to recipes/run_script.expected/no_buildbucket_input.json
index 3884a87..5e326fa 100644
--- a/recipes/run_script.expected/no_repo_specified.json
+++ b/recipes/run_script.expected/no_buildbucket_input.json
@@ -8,7 +8,7 @@
   },
   {
     "failure": {
-      "humanReason": "'repo' is required if build input doesn't specify commit or cl"
+      "humanReason": "gitiles_commit or gerrit_changes must be populated"
     },
     "name": "$result"
   }
diff --git a/recipes/run_script.expected/failed_tests.json b/recipes/run_script.expected/script_failed.json
similarity index 100%
rename from recipes/run_script.expected/failed_tests.json
rename to recipes/run_script.expected/script_failed.json
diff --git a/recipes/run_script.expected/with_repo_property.json b/recipes/run_script.expected/with_repo_property.json
deleted file mode 100644
index 0fcc06b..0000000
--- a/recipes/run_script.expected/with_repo_property.json
+++ /dev/null
@@ -1,275 +0,0 @@
-[
-  {
-    "cmd": [],
-    "name": "checkout"
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "ensure-directory",
-      "--mode",
-      "0777",
-      "[START_DIR]/foo"
-    ],
-    "infra_step": true,
-    "name": "checkout.makedirs",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "init"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git init",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "remote",
-      "add",
-      "origin",
-      "https://fuchsia.googlesource.com/foo"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git remote",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "checkout.cache",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "ensure-directory",
-      "--mode",
-      "0777",
-      "[CACHE]/git/fuchsia.googlesource.com-foo"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.cache.makedirs",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "init",
-      "--bare"
-    ],
-    "cwd": "[CACHE]/git/fuchsia.googlesource.com-foo",
-    "infra_step": true,
-    "name": "checkout.cache.git init",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "config",
-      "remote.origin.url",
-      "https://fuchsia.googlesource.com/foo"
-    ],
-    "cwd": "[CACHE]/git/fuchsia.googlesource.com-foo",
-    "infra_step": true,
-    "name": "checkout.cache.remote set-url",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "config",
-      "--replace-all",
-      "remote.origin.fetch",
-      "+refs/heads/*:refs/heads/*",
-      "\\+refs/heads/\\*:.*"
-    ],
-    "cwd": "[CACHE]/git/fuchsia.googlesource.com-foo",
-    "infra_step": true,
-    "name": "checkout.cache.git config",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "fetch",
-      "--prune",
-      "--tags",
-      "origin"
-    ],
-    "cwd": "[CACHE]/git/fuchsia.googlesource.com-foo",
-    "infra_step": true,
-    "name": "checkout.cache.git fetch",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "ensure-directory",
-      "--mode",
-      "0777",
-      "[START_DIR]/foo/.git/objects/info"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.cache.makedirs object/info",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[CACHE]/git/fuchsia.googlesource.com-foo/objects\n",
-      "[START_DIR]/foo/.git/objects/info/alternates"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.cache.alternates",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@",
-      "@@@STEP_LOG_LINE@alternates@[CACHE]/git/fuchsia.googlesource.com-foo/objects@@@",
-      "@@@STEP_LOG_END@alternates@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "fetch",
-      "--tags",
-      "origin",
-      "deadbeef"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git fetch",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "checkout",
-      "-f",
-      "FETCH_HEAD"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git checkout",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "rev-parse",
-      "HEAD"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git rev-parse",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "clean",
-      "-f",
-      "-d",
-      "-x"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.git clean",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [],
-    "name": "checkout.submodule",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "submodule",
-      "sync"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.submodule.git submodule sync",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "git",
-      "submodule",
-      "update",
-      "--init"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "infra_step": true,
-    "name": "checkout.submodule.git submodule update",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@2@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "run-tests.sh"
-    ],
-    "cwd": "[START_DIR]/foo",
-    "name": "run run-tests.sh"
-  },
-  {
-    "name": "$result"
-  }
-]
\ No newline at end of file
diff --git a/recipes/run_script.py b/recipes/run_script.py
index a0f8edc..d70d0b7 100644
--- a/recipes/run_script.py
+++ b/recipes/run_script.py
@@ -6,44 +6,28 @@
 from recipe_engine.recipe_api import Property
 
 DEPS = [
-    "fuchsia/git",
-    "fuchsia/status_check",
-    "recipe_engine/buildbucket",
-    "recipe_engine/context",
-    "recipe_engine/path",
-    "recipe_engine/properties",
-    "recipe_engine/step",
+    'fuchsia/git',
+    'fuchsia/status_check',
+    'recipe_engine/buildbucket',
+    'recipe_engine/context',
+    'recipe_engine/path',
+    'recipe_engine/properties',
+    'recipe_engine/step',
 ]
 
 PROPERTIES = {
-    'script':
-        Property(
-            kind=str,
-            help='Relative path to the script to run',
-        ),
-    'repo':
-        Property(
-            kind=str,
-            help='URL of the repo containing the script',
-            default=None,
-        ),
-    'ref':
-        Property(
-            kind=str,
-            help='URL of the repo containing the script',
-            default=None,
-        ),
+    'script': Property(
+        kind=str,
+        help='Relative path to the script to run',
+    ),
 }
 
 
-def RunSteps(api, script, repo, ref):
+def RunSteps(api, script):
   bb_input = api.buildbucket.build.input
 
   with api.step.nest('checkout'), api.context(infra_steps=True):
-    if repo:
-      checkout_dir = api.path['start_dir'].join(repo.split('/')[-1])
-      api.git.checkout(repo, ref=ref)
-    elif bb_input.gerrit_changes:
+    if bb_input.gerrit_changes:
       cl = bb_input.gerrit_changes[0]
       checkout_dir = api.path['start_dir'].join(cl.project)
       api.git.checkout_cl(cl, path=checkout_dir)
@@ -52,7 +36,7 @@
       api.git.checkout_commit(bb_input.gitiles_commit, path=checkout_dir)
     else:
       raise api.step.InfraFailure(
-          "'repo' is required if build input doesn't specify commit or cl")
+          'gitiles_commit or gerrit_changes must be populated')
 
   with api.context(cwd=checkout_dir):
     api.step('run %s' % script, [script])
@@ -75,19 +59,14 @@
   )
 
   yield (
-      api.status_check.test('with_repo_property')
-      + api.properties(script='run-tests.sh', repo=repo, ref='deadbeef')
-  )
-
-  yield (
-      api.status_check.test('failed_tests', status='failure')
+      api.status_check.test('script_failed', status='failure')
       + api.properties(script='run-tests.sh')
       + api.buildbucket.ci_build(git_repo=repo)
       + api.step_data('run run-tests.sh', retcode=1)
   )
 
   yield (
-      api.status_check.test('no_repo_specified', status='infra_failure')
+      api.status_check.test('no_buildbucket_input', status='infra_failure')
       + api.properties(script='run-tests.sh')
   )
   # yapf: enable