Inject parent builder tags to test drone
This is a reland of https://flutter-review.googlesource.com/c/recipes/+/33540, which caused recipe failure as `tuple` is not supported.
Context:
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: I1af28789ca4b1dd00f330b8c850dca3f36f72611
Bug: https://github.com/flutter/flutter/issues/103542
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/33521
Reviewed-by: Nehal Patel <nehalvpatel@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..c2150b7 100644
--- a/recipes/devicelab/devicelab_drone_build_test.py
+++ b/recipes/devicelab/devicelab_drone_build_test.py
@@ -93,6 +93,8 @@
bucket = api.buildbucket.build.builder.bucket
builder_name = 'Linux_android_staging test_drone' if bucket == 'staging' else 'Linux Devicelab Test Drone'
reqs = []
+ # Updates tuple to buildbucket API supported list.
+ tags = [tag for tag in api.properties.get('tags', [])]
# These are dependencies specified in the yaml file. We want to pass them down
# to test so they also install these dependencies.
test_props = {
@@ -101,6 +103,7 @@
'parent_builder': api.properties.get('buildername'),
'artifact': artifact,
'git_branch': api.properties.get('git_branch'),
+ 'tags': tags,
}
if 'git_url' in api.properties and 'git_ref' in api.properties:
test_props['git_ref'] = api.properties['git_ref']