pw_presubmit: Fix CIPD manifest paths

Bug: b/332357274
Change-Id: I0cfe3675240bf58b3ef5a6e14ad855305c8c4a1c
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/204234
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/recipe_modules/pw_presubmit/api.py b/recipe_modules/pw_presubmit/api.py
index 92e50a8..1b1b1fc 100644
--- a/recipe_modules/pw_presubmit/api.py
+++ b/recipe_modules/pw_presubmit/api.py
@@ -288,6 +288,13 @@
                         builder_manifest,
                         test_data={'cipd_manifests': ['cipd-manifest.json']},
                     ).get('cipd_manifests', []):
+                        # The path to the cipd manifest in the builder manifest
+                        # is not relative to the current directory where bazel
+                        # was invoked but to the WORKSPACE.
+                        cipd_manifest_path: config_types.Path = (
+                            ctx.checkout.root / cipd_manifest
+                        )
+
                         with (
                             self.m.default_timeout(),
                             self.m.step.nest('builder manifest'),
@@ -298,7 +305,7 @@
                             )
                             defer(
                                 self.m.cipd_upload.manifest,
-                                manifest_path=step.dir / cipd_manifest,
+                                manifest_path=cipd_manifest_path,
                                 build_dir=step.dir,
                                 checkout=ctx.checkout,
                                 upload_to_cipd=(
diff --git a/recipe_modules/pw_presubmit/tests/full.expected/cipd.json b/recipe_modules/pw_presubmit/tests/full.expected/cipd.json
index 73581e5..2b380c9 100644
--- a/recipe_modules/pw_presubmit/tests/full.expected/cipd.json
+++ b/recipe_modules/pw_presubmit/tests/full.expected/cipd.json
@@ -1724,7 +1724,7 @@
       "--json-output",
       "/path/to/tmp/json",
       "copy",
-      "[START_DIR]/checkout/p/step1/cipd-manifest.json",
+      "[START_DIR]/checkout/cipd-manifest.json",
       "/path/to/tmp/json"
     ],
     "infra_step": true,
@@ -1744,7 +1744,7 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "step1.builder manifest.read cipd manifest [START_DIR]/checkout/p/step1/cipd-manifest.json",
+    "name": "step1.builder manifest.read cipd manifest [START_DIR]/checkout/cipd-manifest.json",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@cipd-manifest.json@{}@@@",