[fxt] Update recipes sdk to trigger Guitar project

Bug: 90091

Change-Id: Ib10cbc0cf1a3f89c0a44a555bb45bfc38abbd817
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/recipes/+/617541
Reviewed-by: Anthony Fandrianto <atyfto@google.com>
Commit-Queue: Jessica Gu <jessicacgu@google.com>
diff --git a/recipes/sdk.expected/tap_testing.json b/recipes/sdk.expected/fxt_tests.json
similarity index 98%
copy from recipes/sdk.expected/tap_testing.json
copy to recipes/sdk.expected/fxt_tests.json
index 737e8d2..c299b90 100644
--- a/recipes/sdk.expected/tap_testing.json
+++ b/recipes/sdk.expected/fxt_tests.json
@@ -1920,15 +1920,16 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests",
+    "name": "run fxt tests",
     "~followup_annotations": [
       "@@@STEP_LINK@changelist@http://cl/12345@@@",
-      "@@@STEP_LINK@tap_tests@http://test/test-id@@@"
+      "@@@STEP_LINK@tap_tests@http://test/tap-id@@@",
+      "@@@STEP_LINK@guitar_tests@['http://fusion2/guitar-project-id1']@@@"
     ]
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt",
+    "name": "run fxt tests.ensure fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -1957,7 +1958,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.read manifest",
+    "name": "run fxt tests.ensure fxt.read manifest",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
@@ -1969,7 +1970,7 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt.install path/to/fxt",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@"
     ]
@@ -1999,7 +2000,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure package directory",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure package directory",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@"
     ]
@@ -2030,7 +2031,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure_installed",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure_installed",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
@@ -2060,6 +2061,8 @@
       "/path/to/tmp/json",
       "-tap-project",
       "foo",
+      "-guitar-project",
+      "guitar-project-id=guitar-cluster-id",
       "-sdk"
     ],
     "luci_context": {
@@ -2074,12 +2077,15 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.launch",
+    "name": "run fxt tests.launch",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"change_num\": 12345, @@@",
-      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"test-id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"guitar_project_request_ids\": [@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"guitar-project-id1\"@@@",
+      "@@@STEP_LOG_LINE@json.output@  ], @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"tap-id\", @@@",
       "@@@STEP_LOG_LINE@json.output@  \"workspace\": \"test-ws\"@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
@@ -2092,7 +2098,9 @@
       "-timeout",
       "3600",
       "-tap-request-id",
-      "test-id"
+      "tap-id",
+      "-guitar-project-request-id",
+      "guitar-project-id1"
     ],
     "luci_context": {
       "realm": {
@@ -2106,7 +2114,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.monitor",
+    "name": "run fxt tests.monitor",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -2131,7 +2139,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.cleanup",
+    "name": "run fxt tests.cleanup",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/tap_testing.json b/recipes/sdk.expected/tap_and_fxt_tests.json
similarity index 98%
copy from recipes/sdk.expected/tap_testing.json
copy to recipes/sdk.expected/tap_and_fxt_tests.json
index 737e8d2..dc92eb0 100644
--- a/recipes/sdk.expected/tap_testing.json
+++ b/recipes/sdk.expected/tap_and_fxt_tests.json
@@ -1920,15 +1920,16 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests",
+    "name": "run fxt tests",
     "~followup_annotations": [
       "@@@STEP_LINK@changelist@http://cl/12345@@@",
-      "@@@STEP_LINK@tap_tests@http://test/test-id@@@"
+      "@@@STEP_LINK@tap_tests@http://test/tap_fxt-id@@@",
+      "@@@STEP_LINK@guitar_tests@['http://fusion2/guitar-project-id1']@@@"
     ]
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt",
+    "name": "run fxt tests.ensure fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -1957,7 +1958,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.read manifest",
+    "name": "run fxt tests.ensure fxt.read manifest",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
@@ -1969,7 +1970,7 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt.install path/to/fxt",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@"
     ]
@@ -1999,7 +2000,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure package directory",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure package directory",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@"
     ]
@@ -2030,7 +2031,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure_installed",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure_installed",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
@@ -2059,7 +2060,9 @@
       "-json-output",
       "/path/to/tmp/json",
       "-tap-project",
-      "foo",
+      "foo_tap",
+      "-guitar-project",
+      "guitar-project-id=guitar-cluster-id",
       "-sdk"
     ],
     "luci_context": {
@@ -2074,12 +2077,15 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.launch",
+    "name": "run fxt tests.launch",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"change_num\": 12345, @@@",
-      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"test-id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"guitar_project_request_ids\": [@@@",
+      "@@@STEP_LOG_LINE@json.output@    \"guitar-project-id1\"@@@",
+      "@@@STEP_LOG_LINE@json.output@  ], @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"tap_fxt-id\", @@@",
       "@@@STEP_LOG_LINE@json.output@  \"workspace\": \"test-ws\"@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
@@ -2092,7 +2098,9 @@
       "-timeout",
       "3600",
       "-tap-request-id",
-      "test-id"
+      "tap_fxt-id",
+      "-guitar-project-request-id",
+      "guitar-project-id1"
     ],
     "luci_context": {
       "realm": {
@@ -2106,7 +2114,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.monitor",
+    "name": "run fxt tests.monitor",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -2131,7 +2139,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.cleanup",
+    "name": "run fxt tests.cleanup",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.expected/tap_testing.json b/recipes/sdk.expected/tap_tests.json
similarity index 98%
rename from recipes/sdk.expected/tap_testing.json
rename to recipes/sdk.expected/tap_tests.json
index 737e8d2..f3c89ce 100644
--- a/recipes/sdk.expected/tap_testing.json
+++ b/recipes/sdk.expected/tap_tests.json
@@ -1920,15 +1920,15 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests",
+    "name": "run fxt tests",
     "~followup_annotations": [
       "@@@STEP_LINK@changelist@http://cl/12345@@@",
-      "@@@STEP_LINK@tap_tests@http://test/test-id@@@"
+      "@@@STEP_LINK@tap_tests@http://test/tap-id@@@"
     ]
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt",
+    "name": "run fxt tests.ensure fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -1957,7 +1957,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.read manifest",
+    "name": "run fxt tests.ensure fxt.read manifest",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
@@ -1969,7 +1969,7 @@
   },
   {
     "cmd": [],
-    "name": "run tap tests.ensure fxt.install path/to/fxt",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@"
     ]
@@ -1999,7 +1999,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure package directory",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure package directory",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@"
     ]
@@ -2030,7 +2030,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.ensure fxt.install path/to/fxt.ensure_installed",
+    "name": "run fxt tests.ensure fxt.install path/to/fxt.ensure_installed",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@3@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
@@ -2074,12 +2074,13 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.launch",
+    "name": "run fxt tests.launch",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"change_num\": 12345, @@@",
-      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"test-id\", @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"guitar_project_request_ids\": [], @@@",
+      "@@@STEP_LOG_LINE@json.output@  \"tap_request_id\": \"tap-id\", @@@",
       "@@@STEP_LOG_LINE@json.output@  \"workspace\": \"test-ws\"@@@",
       "@@@STEP_LOG_LINE@json.output@}@@@",
       "@@@STEP_LOG_END@json.output@@@"
@@ -2092,7 +2093,7 @@
       "-timeout",
       "3600",
       "-tap-request-id",
-      "test-id"
+      "tap-id"
     ],
     "luci_context": {
       "realm": {
@@ -2106,7 +2107,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.monitor",
+    "name": "run fxt tests.monitor",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
@@ -2131,7 +2132,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "run tap tests.cleanup",
+    "name": "run fxt tests.cleanup",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@"
     ]
diff --git a/recipes/sdk.proto b/recipes/sdk.proto
index 5841732..a07fe54 100644
--- a/recipes/sdk.proto
+++ b/recipes/sdk.proto
@@ -52,7 +52,7 @@
   // Timeout for collecting subbuilds.
   int32 subbuild_collect_timeout_secs = 9;
 
-  // How to test the SDK in external infrastructures. See ExternalTesting docs.
+  // How to test the SDK in external infrastructures. See ExternalTesting message.
   ExternalTesting external_testing = 10;
 
   message ExternalTesting {
@@ -94,11 +94,11 @@
     string ref = 12;
   }
 
-  // How to test the SDK in TAP. See TapTesting docs.
+  // How to test the SDK in TAP. See TapTesting message.
   TapTesting tap_testing = 11;
 
+  // TODO(fxbug.dev/90091): Deprecate TapTesting for FxtTests.
   message TapTesting {
-    // TAP projects to trigger.
     repeated string tap_projects = 1;
 
     // Whether to use staging host for RPCs.
@@ -111,4 +111,21 @@
   // Path to a fint parameters file within the fuchsia checkout. If set will use
   // `fint set` instead of `gn gen`.
   string fint_params_path = 12;
+
+  // How to test the SDK in TAP. See TapTesting message.
+  FxtTests fxt_tests = 13;
+
+  message FxtTests {
+    // TAP projects to trigger.
+    repeated string tap_projects = 1;
+
+    // Guitar projects to trigger.
+    map<string, string> guitar_projects = 2;
+
+    // Whether to use staging host for RPCs.
+    bool use_staging_host = 3;
+
+    // How long to wait for external tests to finish.
+    int32 timeout_secs = 4;
+  }
 }
diff --git a/recipes/sdk.py b/recipes/sdk.py
index 836a40f..d07e4ce 100644
--- a/recipes/sdk.py
+++ b/recipes/sdk.py
@@ -55,13 +55,13 @@
 If external tests were triggered, wait on CQ to complete, and report success or
 fail.
 
-## Trigger TAP tests
+## Trigger Fxt tests
 
-Optionally trigger tests against TAP to test that the new SDK is compatible.
+Optionally trigger tests against Fxt to test that the new SDK is compatible.
 
-## Collect TAP tests
+## Collect Fxt tests
 
-If TAP tests were triggered, wait on TAP to complete and report success or fail.
+If Fxt tests were triggered, wait on Fxt to complete and report success or fail.
 """
 
 import datetime
@@ -263,19 +263,29 @@
         api.cl_util.abandon_cl("abandon CL", change_num=change_info["number"])
 
 
-def run_tap_tests(api, presentation, sdk_id, bucket, tap_testing):
+# TODO(fxbug.dev/90091): Deprecate tap_testing for fxt_tests.
+def run_fxt_tests(api, presentation, sdk_id, bucket, tap_testing, fxt_tests):
     """Dry-run SDK against one or more TAP projects.
 
     The TAP projects must respect custom Fuchsia SDK parameters on a CL, which
     are specified by the bucket and namespace overrides.
     """
-    api.fxt.use_staging_host = tap_testing.use_staging_host
+    api.fxt.use_staging_host = fxt_tests.use_staging_host
+    tap_projects = fxt_tests.tap_projects
+    timeout_secs = fxt_tests.timeout_secs
+    # Use tap_testing.tap_projects if not empty
+    if tap_testing.tap_projects:
+        api.fxt.use_staging_host = tap_testing.use_staging_host
+        tap_projects = tap_testing.tap_projects
+        timeout_secs = tap_testing.timeout_secs
+
     resp = api.fxt.launch(
         step_name="launch",
         bucket=bucket,
         namespace=sdk_id,
         name=api.buildbucket.builder_name,
-        tap_projects=tap_testing.tap_projects,
+        tap_projects=tap_projects,
+        guitar_projects=fxt_tests.guitar_projects,
         sdk_mode=True,
         presentation=presentation,
     )
@@ -283,7 +293,8 @@
         api.fxt.monitor(
             step_name="monitor",
             tap_request_id=resp["tap_request_id"],
-            timeout_secs=tap_testing.timeout_secs,
+            guitar_project_request_ids=resp["guitar_project_request_ids"],
+            timeout_secs=timeout_secs,
         )
     finally:
         api.fxt.cleanup(step_name="cleanup", workspace=resp["workspace"])
@@ -607,14 +618,20 @@
     # and TAP tests serially, which is not efficient if both are specified by
     # the proto. If we ever have builders which want to run both, we should
     # frontload both triggers ahead of their respective collects.
-    if props.tap_testing.tap_projects:
-        with api.step.nest("run tap tests") as presentation:
-            run_tap_tests(
+    # TODO(fxbug.dev/90091): Deprecate tap_testing for fxt_tests.
+    if (
+        props.tap_testing.tap_projects
+        or props.fxt_tests.tap_projects
+        or props.fxt_tests.guitar_projects
+    ):
+        with api.step.nest("run fxt tests") as presentation:
+            run_fxt_tests(
                 api,
                 presentation=presentation,
                 sdk_id=sdk_id,
                 bucket=props.gcs_bucket,
                 tap_testing=props.tap_testing,
+                fxt_tests=props.fxt_tests,
             )
 
 
@@ -844,8 +861,9 @@
     ]
 
     yield api.buildbucket_util.test("cq", tryjob=True) + properties() + cq_subbuilds
+    # TODO(fxbug.dev/90091): Deprecate tap_testing for fxt_tests.
     yield (
-        api.buildbucket_util.test("tap_testing")
+        api.buildbucket_util.test("tap_tests")
         + properties(
             tap_testing=InputProperties.TapTesting(
                 tap_projects=["foo"],
@@ -855,14 +873,64 @@
         )
         + ci_subbuilds
         + api.fxt.launch(
-            "run tap tests.launch",
+            "run fxt tests.launch",
             test_data={
-                "tap_request_id": "test-id",
+                "tap_request_id": "tap-id",
+                "guitar_project_request_ids": [],
                 "workspace": "test-ws",
                 "change_num": 12345,
             },
         )
-        + api.fxt.monitor("run tap tests.monitor", success=True)
+        + api.fxt.monitor("run fxt tests.monitor", success=True)
+    )
+    yield (
+        api.buildbucket_util.test("fxt_tests")
+        + properties(
+            fxt_tests=InputProperties.FxtTests(
+                tap_projects=["foo"],
+                guitar_projects={"guitar-project-id": "guitar-cluster-id"},
+                use_staging_host=False,
+                timeout_secs=60 * 60,
+            ),
+        )
+        + ci_subbuilds
+        + api.fxt.launch(
+            "run fxt tests.launch",
+            test_data={
+                "tap_request_id": "tap-id",
+                "guitar_project_request_ids": ["guitar-project-id1"],
+                "workspace": "test-ws",
+                "change_num": 12345,
+            },
+        )
+        + api.fxt.monitor("run fxt tests.monitor", success=True)
+    )
+    yield (
+        api.buildbucket_util.test("tap_and_fxt_tests")
+        + properties(
+            tap_testing=InputProperties.TapTesting(
+                tap_projects=["foo_tap"],
+                use_staging_host=False,
+                timeout_secs=60 * 60,
+            ),
+            fxt_tests=InputProperties.FxtTests(
+                tap_projects=["foo_fxt"],
+                guitar_projects={"guitar-project-id": "guitar-cluster-id"},
+                use_staging_host=False,
+                timeout_secs=60 * 60,
+            ),
+        )
+        + ci_subbuilds
+        + api.fxt.launch(
+            "run fxt tests.launch",
+            test_data={
+                "tap_request_id": "tap_fxt-id",
+                "guitar_project_request_ids": ["guitar-project-id1"],
+                "workspace": "test-ws",
+                "change_num": 12345,
+            },
+        )
+        + api.fxt.monitor("run fxt tests.monitor", success=True)
     )
     yield (
         api.buildbucket_util.test("external_testing")