[cobalt_config] Add project property.

This is needed for running this recipe on a different repo.

Bug: 45618
Change-Id: Ib230d1d026098798d6b18093630ec4afba611b55
diff --git a/recipes/cobalt_config.expected/ci.json b/recipes/cobalt_config.expected/ci.json
index f1c2ac5..b0e808f 100644
--- a/recipes/cobalt_config.expected/ci.json
+++ b/recipes/cobalt_config.expected/ci.json
@@ -137,6 +137,35 @@
   },
   {
     "cmd": [
+      "[START_DIR]/cipd/jiri/jiri",
+      "project",
+      "-vv",
+      "-time",
+      "-j=50",
+      "-json-output",
+      "/path/to/tmp/json",
+      "cobalt-registry"
+    ],
+    "infra_step": true,
+    "name": "jiri project",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@json.output@[@@@",
+      "@@@STEP_LOG_LINE@json.output@  {@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"branches\": [@@@",
+      "@@@STEP_LOG_LINE@json.output@      \"(HEAD detached at c22471f)\"@@@",
+      "@@@STEP_LOG_LINE@json.output@    ], @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"current_branch\": \"\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"name\": \"cobalt-registry\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"path\": \"path/to/cobalt-registry\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"remote\": \"https://fuchsia.googlesource.com/cobalt-registry\", @@@",
+      "@@@STEP_LOG_LINE@json.output@    \"revision\": \"c22471f4e3f842ae18dd9adec82ed9eb78ed1127\"@@@",
+      "@@@STEP_LOG_LINE@json.output@  }@@@",
+      "@@@STEP_LOG_LINE@json.output@]@@@",
+      "@@@STEP_LOG_END@json.output@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "-u",
       "./cobaltb.py",
@@ -163,7 +192,8 @@
       "--output_file",
       "[START_DIR]/new_config",
       "--config_dir",
-      "[START_DIR]/third_party/cobalt_config"
+      "[START_DIR]/path/to/cobalt-registry",
+      "--allow_empty_output"
     ],
     "name": "check config"
   },
@@ -173,7 +203,7 @@
       "checkout",
       "HEAD^"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "checkout parent"
   },
   {
@@ -182,7 +212,8 @@
       "--output_file",
       "[START_DIR]/old_config",
       "--config_dir",
-      "[START_DIR]/third_party/cobalt_config"
+      "[START_DIR]/path/to/cobalt-registry",
+      "--allow_empty_output"
     ],
     "name": "check parent config"
   },
@@ -192,7 +223,7 @@
       "checkout",
       "-"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "checkout head"
   },
   {
@@ -202,7 +233,7 @@
       "-s",
       "--format=%b"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "read commit message"
   },
   {
diff --git a/recipes/cobalt_config.expected/cq_try.json b/recipes/cobalt_config.expected/cq_try.json
index 2843a32..afa46a6 100644
--- a/recipes/cobalt_config.expected/cq_try.json
+++ b/recipes/cobalt_config.expected/cq_try.json
@@ -320,7 +320,8 @@
       "--output_file",
       "[START_DIR]/new_config",
       "--config_dir",
-      "[START_DIR]/third_party/cobalt_config"
+      "[START_DIR]/path/to/cobalt-registry",
+      "--allow_empty_output"
     ],
     "name": "check config"
   },
@@ -330,7 +331,7 @@
       "checkout",
       "HEAD^"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "checkout parent"
   },
   {
@@ -339,7 +340,8 @@
       "--output_file",
       "[START_DIR]/old_config",
       "--config_dir",
-      "[START_DIR]/third_party/cobalt_config"
+      "[START_DIR]/path/to/cobalt-registry",
+      "--allow_empty_output"
     ],
     "name": "check parent config"
   },
@@ -349,7 +351,7 @@
       "checkout",
       "-"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "checkout head"
   },
   {
@@ -359,7 +361,7 @@
       "-s",
       "--format=%b"
     ],
-    "cwd": "[START_DIR]/third_party/cobalt_config",
+    "cwd": "[START_DIR]/path/to/cobalt-registry",
     "name": "read commit message"
   },
   {
diff --git a/recipes/cobalt_config.py b/recipes/cobalt_config.py
index ddf77e9..6e5b9c1 100644
--- a/recipes/cobalt_config.py
+++ b/recipes/cobalt_config.py
@@ -27,13 +27,15 @@
     'manifest':
         Property(
             kind=str, help='Jiri manifest file to use, relative to `remote`'),
+    'project':
+        Property(
+            kind=str,
+            help='Jiri manifest project name for the cobalt-registry repo.',
+            default='cobalt-registry'),
 }
 
-# The name of the gerrit project tested by this recipe.
-MANIFEST_PROJECT_NAME = 'cobalt-registry'
 
-
-def RunSteps(api, remote, manifest):
+def RunSteps(api, remote, manifest, project):
   # Check out the project from the specified manifest.
   with api.context(infra_steps=True):
     build_input = api.buildbucket.build.input
@@ -41,13 +43,15 @@
         path=api.path['start_dir'],
         manifest=manifest,
         remote=remote,
-        project=MANIFEST_PROJECT_NAME,
-        build_input=build_input)
+        project=project,
+        patch_project=project,
+        build_input=build_input,
+    )
 
     revision = build_input.gitiles_commit.id
+    cobalt_config_project = api.jiri.project([project]).json.output[0]
     if not revision:
-      revision = api.jiri.project([MANIFEST_PROJECT_NAME
-                                  ]).json.output[0]['revision']
+      revision = cobalt_config_project['revision']
       api.step.active_result.presentation.properties['got_revision'] = revision
 
   # Root of the cobalt repo as checked out by the manifest.
@@ -63,7 +67,7 @@
   config_validator_bin = tools_dir.join('config_change_validator')
 
   # Root of the config repo as checked out by the manifest.
-  config_src_dir = api.path['start_dir'].join('third_party/cobalt_config')
+  config_src_dir = api.path['start_dir'].join(cobalt_config_project['path'])
 
   # Run config_parser on the config repo checkout.
   api.step('check config', [
@@ -72,6 +76,7 @@
       api.path['start_dir'].join('new_config'),
       '--config_dir',
       config_src_dir,
+      '--allow_empty_output',
   ])
 
   with api.context(cwd=config_src_dir):
@@ -83,6 +88,7 @@
       api.path['start_dir'].join('old_config'),
       '--config_dir',
       config_src_dir,
+      '--allow_empty_output',
   ])
 
   commit_msg = ""
@@ -110,11 +116,11 @@
              remote='https://fuchsia.googlesource.com/manifest',
              manifest='config.manifest',
              project='cobalt-registry',
-         ))
+         ) + api.properties(project='cobalt-registry'))
   yield (api.test('cq_try') + api.buildbucket.try_build(
       git_repo='https://fuchsia.googlesource.com/cobalt-registry',) +
          api.properties.tryserver(
              remote='https://fuchsia.googlesource.com/manifest',
              manifest='config.manifest',
              project='cobalt-registry',
-         ))
+         ) + api.properties(project='cobalt-registry'))