Inject parent builders tags

These tags are needed to collect device tags for Skia benchmark metrics. Otherwise, metrics will lose corresponding devices tags and cause benchmark metrics discontinuity.

Change-Id: I7fdfcc762b9bbc108f7a6b4bbe9c9f7cc4c26989
Bug: https://github.com/flutter/flutter/issues/103542
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/33540
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
diff --git a/recipes/devicelab/devicelab_drone_build_test.expected/artifact does not exist.json b/recipes/devicelab/devicelab_drone_build_test.expected/artifact does not exist.json
index 824b89a..a6a4103 100644
--- a/recipes/devicelab/devicelab_drone_build_test.expected/artifact does not exist.json
+++ b/recipes/devicelab/devicelab_drone_build_test.expected/artifact does not exist.json
@@ -809,7 +809,7 @@
       }
     },
     "name": "buildbucket.schedule",
-    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci\", \"builder\": \"Linux Devicelab Test Drone\", \"project\": \"test\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"git.example.com\", \"id\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\", \"project\": \"test/repo\", \"ref\": \"refs/heads/main\"}, \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"parent_builder\": \"Linux abc\", \"task_name\": \"abc\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
+    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci\", \"builder\": \"Linux Devicelab Test Drone\", \"project\": \"test\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"git.example.com\", \"id\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\", \"project\": \"test/repo\", \"ref\": \"refs/heads/main\"}, \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"parent_builder\": \"Linux abc\", \"tags\": [], \"task_name\": \"abc\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"responses\": [@@@",
@@ -855,6 +855,7 @@
       "@@@STEP_LOG_LINE@request@          \"dependencies\": [], @@@",
       "@@@STEP_LOG_LINE@request@          \"git_branch\": \"master\", @@@",
       "@@@STEP_LOG_LINE@request@          \"parent_builder\": \"Linux abc\", @@@",
+      "@@@STEP_LOG_LINE@request@          \"tags\": [], @@@",
       "@@@STEP_LOG_LINE@request@          \"task_name\": \"abc\"@@@",
       "@@@STEP_LOG_LINE@request@        }, @@@",
       "@@@STEP_LOG_LINE@request@        \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", @@@",
diff --git a/recipes/devicelab/devicelab_drone_build_test.expected/artifact exists.json b/recipes/devicelab/devicelab_drone_build_test.expected/artifact exists.json
index ff5728d..2492bb3 100644
--- a/recipes/devicelab/devicelab_drone_build_test.expected/artifact exists.json
+++ b/recipes/devicelab/devicelab_drone_build_test.expected/artifact exists.json
@@ -34,7 +34,7 @@
     ],
     "infra_step": true,
     "name": "buildbucket.schedule",
-    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"builder\": \"Linux Devicelab Test Drone\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"git_ref\": \"refs/pull/1/head\", \"git_url\": \"test/repo\", \"parent_builder\": \"Linux abc\", \"task_name\": \"abc\"}, \"requestId\": \"0-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"0\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
+    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"builder\": \"Linux Devicelab Test Drone\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"git_ref\": \"refs/pull/1/head\", \"git_url\": \"test/repo\", \"parent_builder\": \"Linux abc\", \"tags\": [], \"task_name\": \"abc\"}, \"requestId\": \"0-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"0\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"responses\": [@@@",
@@ -72,6 +72,7 @@
       "@@@STEP_LOG_LINE@request@          \"git_ref\": \"refs/pull/1/head\", @@@",
       "@@@STEP_LOG_LINE@request@          \"git_url\": \"test/repo\", @@@",
       "@@@STEP_LOG_LINE@request@          \"parent_builder\": \"Linux abc\", @@@",
+      "@@@STEP_LOG_LINE@request@          \"tags\": [], @@@",
       "@@@STEP_LOG_LINE@request@          \"task_name\": \"abc\"@@@",
       "@@@STEP_LOG_LINE@request@        }, @@@",
       "@@@STEP_LOG_LINE@request@        \"requestId\": \"0-00000000-0000-0000-0000-000000001337\", @@@",
diff --git a/recipes/devicelab/devicelab_drone_build_test.expected/local-engine.json b/recipes/devicelab/devicelab_drone_build_test.expected/local-engine.json
index de9336d..64bd229 100644
--- a/recipes/devicelab/devicelab_drone_build_test.expected/local-engine.json
+++ b/recipes/devicelab/devicelab_drone_build_test.expected/local-engine.json
@@ -980,7 +980,7 @@
       }
     },
     "name": "buildbucket.schedule",
-    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci\", \"builder\": \"Linux Devicelab Test Drone\", \"project\": \"test\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"git.example.com\", \"id\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\", \"project\": \"test/repo\", \"ref\": \"refs/heads/master\"}, \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"parent_builder\": \"Linux abc\", \"task_name\": \"abc\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
+    "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci\", \"builder\": \"Linux Devicelab Test Drone\", \"project\": \"test\"}, \"exe\": {\"cipdVersion\": \"refs/heads/master\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"git.example.com\", \"id\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\", \"project\": \"test/repo\", \"ref\": \"refs/heads/master\"}, \"priority\": 25, \"properties\": {\"artifact\": \"def\", \"dependencies\": [], \"git_branch\": \"master\", \"parent_builder\": \"Linux abc\", \"tags\": [], \"task_name\": \"abc\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@json.output@{@@@",
       "@@@STEP_LOG_LINE@json.output@  \"responses\": [@@@",
@@ -1026,6 +1026,7 @@
       "@@@STEP_LOG_LINE@request@          \"dependencies\": [], @@@",
       "@@@STEP_LOG_LINE@request@          \"git_branch\": \"master\", @@@",
       "@@@STEP_LOG_LINE@request@          \"parent_builder\": \"Linux abc\", @@@",
+      "@@@STEP_LOG_LINE@request@          \"tags\": [], @@@",
       "@@@STEP_LOG_LINE@request@          \"task_name\": \"abc\"@@@",
       "@@@STEP_LOG_LINE@request@        }, @@@",
       "@@@STEP_LOG_LINE@request@        \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", @@@",
diff --git a/recipes/devicelab/devicelab_drone_build_test.py b/recipes/devicelab/devicelab_drone_build_test.py
index 5129058..34d483d 100644
--- a/recipes/devicelab/devicelab_drone_build_test.py
+++ b/recipes/devicelab/devicelab_drone_build_test.py
@@ -101,6 +101,7 @@
       'parent_builder': api.properties.get('buildername'),
       'artifact': artifact,
       'git_branch': api.properties.get('git_branch'),
+      'tags': api.properties.get('tags', []),
   }
   if 'git_url' in api.properties and 'git_ref' in api.properties:
     test_props['git_ref'] = api.properties['git_ref']