cq_label: Use auto_roller dry run messages

Change-Id: I2b32d6f4de1e6262409079367b69d957b5ef8fb8
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/105566
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/recipes/cq_label.expected/dry-run.json b/recipes/cq_label.expected/dry-run.json
index 05f6e3a..7d4960e 100644
--- a/recipes/cq_label.expected/dry-run.json
+++ b/recipes/cq_label.expected/dry-run.json
@@ -157,7 +157,7 @@
       "@@@STEP_LOG_LINE@json.output@      \"author\": {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"email\": \"cq-bot-account@gserviceaccount.com\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
-      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed\"@@@",
+      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed the CQ dry run.\"@@@",
       "@@@STEP_LOG_LINE@json.output@    }@@@",
       "@@@STEP_LOG_LINE@json.output@  ], @@@",
       "@@@STEP_LOG_LINE@json.output@  \"project\": \"pigweed\", @@@",
diff --git a/recipes/cq_label.expected/passed.json b/recipes/cq_label.expected/passed.json
index f9f4a8c..646cfad 100644
--- a/recipes/cq_label.expected/passed.json
+++ b/recipes/cq_label.expected/passed.json
@@ -157,7 +157,7 @@
       "@@@STEP_LOG_LINE@json.output@      \"author\": {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"email\": \"cq-bot-account@gserviceaccount.com\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
-      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed\"@@@",
+      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed the CQ dry run.\"@@@",
       "@@@STEP_LOG_LINE@json.output@    }@@@",
       "@@@STEP_LOG_LINE@json.output@  ], @@@",
       "@@@STEP_LOG_LINE@json.output@  \"project\": \"pigweed\", @@@",
diff --git a/recipes/cq_label.expected/wrong-author.json b/recipes/cq_label.expected/wrong-author.json
index 5bdeea1..263cbee 100644
--- a/recipes/cq_label.expected/wrong-author.json
+++ b/recipes/cq_label.expected/wrong-author.json
@@ -157,7 +157,7 @@
       "@@@STEP_LOG_LINE@json.output@      \"author\": {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"email\": \"test@example.com\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
-      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed\"@@@",
+      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 2: Dry run: This CL passed the CQ dry run.\"@@@",
       "@@@STEP_LOG_LINE@json.output@    }@@@",
       "@@@STEP_LOG_LINE@json.output@  ], @@@",
       "@@@STEP_LOG_LINE@json.output@  \"project\": \"pigweed\", @@@",
diff --git a/recipes/cq_label.expected/wrong-patchset.json b/recipes/cq_label.expected/wrong-patchset.json
index f0b8f40..cbfa01f 100644
--- a/recipes/cq_label.expected/wrong-patchset.json
+++ b/recipes/cq_label.expected/wrong-patchset.json
@@ -157,7 +157,7 @@
       "@@@STEP_LOG_LINE@json.output@      \"author\": {@@@",
       "@@@STEP_LOG_LINE@json.output@        \"email\": \"cq-bot-account@gserviceaccount.com\"@@@",
       "@@@STEP_LOG_LINE@json.output@      }, @@@",
-      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 1: Dry run: This CL passed\"@@@",
+      "@@@STEP_LOG_LINE@json.output@      \"message\": \"Patch Set 1: Dry run: This CL passed the CQ dry run.\"@@@",
       "@@@STEP_LOG_LINE@json.output@    }@@@",
       "@@@STEP_LOG_LINE@json.output@  ], @@@",
       "@@@STEP_LOG_LINE@json.output@  \"project\": \"pigweed\", @@@",
diff --git a/recipes/cq_label.py b/recipes/cq_label.py
index 74b299a..6105fd4 100644
--- a/recipes/cq_label.py
+++ b/recipes/cq_label.py
@@ -24,8 +24,13 @@
 from PB.go.chromium.org.luci.buildbucket.proto import common
 from PB.recipe_engine import result
 from PB.recipes.pigweed.cq_label import InputProperties
+from RECIPE_MODULES.fuchsia.auto_roller.api import (
+    FAILED_DRY_RUN_MESSAGES,
+    PASSED_DRY_RUN_MESSAGES,
+)
 
 DEPS = [
+    'fuchsia/auto_roller',
     'fuchsia/gerrit',
     'fuchsia/status_check',
     'recipe_engine/json',
@@ -95,25 +100,23 @@
                 if message['author']['email'] != cq_account:
                     continue
 
-                passed = re.search(
-                    rf'Patch Set {patch}:\s*Dry run: This CL passed',
-                    message['message'],
-                    re.IGNORECASE,
-                )
-                if passed:
-                    with api.step.nest('passed'):
-                        value = 1
-                        break
+                if not message['message'].startswith(f'Patch Set {patch}:'):
+                    continue
 
-                failed = re.search(
-                    rf'Patch Set {patch}:\s*Dry run: Failed builds',
-                    message['message'],
-                    re.IGNORECASE,
-                )
-                if failed:
-                    with api.step.nest('failed'):
-                        value = -1
-                        break
+                for msg in PASSED_DRY_RUN_MESSAGES:
+                    if msg in message['message']:
+                        with api.step.nest('passed'):
+                            value = 1
+                            break
+
+                for msg in FAILED_DRY_RUN_MESSAGES:
+                    if msg in message['message']:
+                        with api.step.nest('failed'):
+                            value = -1
+                            break
+
+                if value:
+                    break
 
             if value:
                 if dry_run:
@@ -265,11 +268,13 @@
         )
 
     def message(patch_set, passed, author=CQ_BOT_ACCOUNT):
+        passfail = FAILED_DRY_RUN_MESSAGES[0]
+        if passed:
+            passfail = PASSED_DRY_RUN_MESSAGES[0]
+
         return {
             'author': {'email': author,},
-            'message': 'Patch Set {}: Dry run: {}'.format(
-                patch_set, 'This CL passed' if passed else 'Failed builds',
-            ),
+            'message': f'Patch Set {patch_set}: {passfail}',
         }
 
     def details(*messages, **kwargs):