diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md
index 02be67380..0f42a4427 100644
--- a/recipes/README.recipes.md
+++ b/recipes/README.recipes.md
@@ -41,6 +41,7 @@
* [presubmit:tests/prepare](#recipes-presubmit_tests_prepare)
* [tryserver:examples/full](#recipes-tryserver_examples_full)
* [tryserver:tests/gerrit_change_fetch_ref_timeout](#recipes-tryserver_tests_gerrit_change_fetch_ref_timeout)
+ * [tryserver:tests/gerrit_change_owner](#recipes-tryserver_tests_gerrit_change_owner)
* [tryserver:tests/gerrit_change_target_ref](#recipes-tryserver_tests_gerrit_change_target_ref)
* [windows_sdk:examples/full](#recipes-windows_sdk_examples_full)
## Recipe Modules
@@ -780,31 +781,38 @@ Returns:
#### **class [TryserverApi](/recipes/recipe_modules/tryserver/api.py#11)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
- **@property**
— **def [gerrit\_change](/recipes/recipe_modules/tryserver/api.py#32)(self):**
+ **@property**
— **def [gerrit\_change](/recipes/recipe_modules/tryserver/api.py#33)(self):**
Returns current gerrit change, if there is exactly one.
Returns a self.m.buildbucket.common_pb2.GerritChange or None.
- **@property**
— **def [gerrit\_change\_fetch\_ref](/recipes/recipe_modules/tryserver/api.py#96)(self):**
+ **@property**
— **def [gerrit\_change\_fetch\_ref](/recipes/recipe_modules/tryserver/api.py#110)(self):**
Returns gerrit patch ref, e.g. "refs/heads/45/12345/6, or None.
Populated iff gerrit_change is populated.
- **@property**
— **def [gerrit\_change\_repo\_url](/recipes/recipe_modules/tryserver/api.py#40)(self):**
+ **@property**
— **def [gerrit\_change\_owner](/recipes/recipe_modules/tryserver/api.py#49)(self):**
+
+Returns owner of the current Gerrit CL.
+
+Populated iff gerrit_change is populated.
+Is a dictionary with keys like "name".
+
+ **@property**
— **def [gerrit\_change\_repo\_url](/recipes/recipe_modules/tryserver/api.py#41)(self):**
Returns canonical URL of the gitiles repo of the current Gerrit CL.
Populated iff gerrit_change is populated.
- **@property**
— **def [gerrit\_change\_target\_ref](/recipes/recipe_modules/tryserver/api.py#105)(self):**
+ **@property**
— **def [gerrit\_change\_target\_ref](/recipes/recipe_modules/tryserver/api.py#119)(self):**
Returns gerrit change destination ref, e.g. "refs/heads/master".
Populated iff gerrit_change is populated.
-— **def [get\_files\_affected\_by\_patch](/recipes/recipe_modules/tryserver/api.py#135)(self, patch_root, \*\*kwargs):**
+— **def [get\_files\_affected\_by\_patch](/recipes/recipe_modules/tryserver/api.py#149)(self, patch_root, \*\*kwargs):**
Returns list of paths to files affected by the patch.
@@ -814,36 +822,36 @@ Argument:
Returned paths will be relative to to patch_root.
-— **def [get\_footer](/recipes/recipe_modules/tryserver/api.py#245)(self, tag, patch_text=None):**
+— **def [get\_footer](/recipes/recipe_modules/tryserver/api.py#259)(self, tag, patch_text=None):**
Gets a specific tag from a CL description
-— **def [get\_footers](/recipes/recipe_modules/tryserver/api.py#225)(self, patch_text=None):**
+— **def [get\_footers](/recipes/recipe_modules/tryserver/api.py#239)(self, patch_text=None):**
Retrieves footers from the patch description.
footers are machine readable tags embedded in commit messages. See
git-footers documentation for more information.
-— **def [initialize](/recipes/recipe_modules/tryserver/api.py#21)(self):**
+— **def [initialize](/recipes/recipe_modules/tryserver/api.py#22)(self):**
- **@property**
— **def [is\_gerrit\_issue](/recipes/recipe_modules/tryserver/api.py#119)(self):**
+ **@property**
— **def [is\_gerrit\_issue](/recipes/recipe_modules/tryserver/api.py#133)(self):**
Returns true iff the properties exist to match a Gerrit issue.
- **@property**
— **def [is\_patch\_in\_git](/recipes/recipe_modules/tryserver/api.py#129)(self):**
+ **@property**
— **def [is\_patch\_in\_git](/recipes/recipe_modules/tryserver/api.py#143)(self):**
- **@property**
— **def [is\_tryserver](/recipes/recipe_modules/tryserver/api.py#114)(self):**
+ **@property**
— **def [is\_tryserver](/recipes/recipe_modules/tryserver/api.py#128)(self):**
Returns true iff we have a change to check out.
-— **def [normalize\_footer\_name](/recipes/recipe_modules/tryserver/api.py#249)(self, footer):**
+— **def [normalize\_footer\_name](/recipes/recipe_modules/tryserver/api.py#263)(self, footer):**
-— **def [set\_compile\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#188)(self):**
+— **def [set\_compile\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#202)(self):**
Mark the tryjob result as a compile failure.
-— **def [set\_invalid\_test\_results\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#200)(self):**
+— **def [set\_invalid\_test\_results\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#214)(self):**
Mark the tryjob result as having invalid test results.
@@ -851,32 +859,32 @@ This means we run some tests, but the results were not valid
(e.g. no list of specific test cases that failed, or too many
tests failing, etc).
-— **def [set\_patch\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#184)(self):**
+— **def [set\_patch\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#198)(self):**
Mark the tryjob result as failure to apply the patch.
-— **def [set\_subproject\_tag](/recipes/recipe_modules/tryserver/api.py#162)(self, subproject_tag):**
+— **def [set\_subproject\_tag](/recipes/recipe_modules/tryserver/api.py#176)(self, subproject_tag):**
Adds a subproject tag to the build.
This can be used to distinguish between builds that execute different steps
depending on what was patched, e.g. blink vs. pure chromium patches.
-— **def [set\_test\_expired\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#217)(self):**
+— **def [set\_test\_expired\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#231)(self):**
Mark the tryjob result as a test expiration.
This means a test task expired and was never scheduled, most likely due to
lack of capacity.
-— **def [set\_test\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#192)(self):**
+— **def [set\_test\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#206)(self):**
Mark the tryjob result as a test failure.
This means we started running actual tests (not prerequisite steps
like checkout or compile), and some of these tests have failed.
-— **def [set\_test\_timeout\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#209)(self):**
+— **def [set\_test\_timeout\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#223)(self):**
Mark the tryjob result as a test timeout.
@@ -1035,6 +1043,11 @@ Move things around in a loop!
[DEPS](/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py#7): [gerrit](#recipe_modules-gerrit), [tryserver](#recipe_modules-tryserver), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/properties][recipe_engine/recipe_modules/properties]
— **def [RunSteps](/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py#15)(api):**
+### *recipes* / [tryserver:tests/gerrit\_change\_owner](/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py)
+
+[DEPS](/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py#7): [gerrit](#recipe_modules-gerrit), [tryserver](#recipe_modules-tryserver), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket]
+
+— **def [RunSteps](/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py#14)(api):**
### *recipes* / [tryserver:tests/gerrit\_change\_target\_ref](/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py)
[DEPS](/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py#7): [gerrit](#recipe_modules-gerrit), [tryserver](#recipe_modules-tryserver), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json b/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json
index ef867e256..dba3f8f72 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json
index a6d166450..277eb98ee 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json
index a0f8c8f42..97ceb4089 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json
index 9e98817cc..9b7e0469f 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json
index b529b5994..2890488e3 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json
index a6d166450..277eb98ee 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json
index 1fe40e616..1fa7c4844 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"refs/branch-heads/67\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json
index ce570dd60..1744e2c88 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"refs/heads/experimental/feature\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json
index f50863c7f..df5b0e536 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"refs/heads/experimental/feature\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json
index 768060c24..509fd7dd2 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json
index 34a226aaa..3d0315d00 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json
index 708325234..a932d1756 100644
--- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json
+++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"7\", @@@",
diff --git a/recipes/recipe_modules/tryserver/api.py b/recipes/recipe_modules/tryserver/api.py
index 419890bcd..f8bd11111 100644
--- a/recipes/recipe_modules/tryserver/api.py
+++ b/recipes/recipe_modules/tryserver/api.py
@@ -17,6 +17,7 @@ class TryserverApi(recipe_api.RecipeApi):
self._gerrit_info_initialized = False
self._gerrit_change_target_ref = None
self._gerrit_change_fetch_ref = None
+ self._gerrit_change_owner = None
def initialize(self):
changes = self.m.buildbucket.build.input.gerrit_changes
@@ -45,6 +46,15 @@ class TryserverApi(recipe_api.RecipeApi):
"""
return self._gerrit_change_repo_url
+ @property
+ def gerrit_change_owner(self):
+ """Returns owner of the current Gerrit CL.
+
+ Populated iff gerrit_change is populated.
+ Is a dictionary with keys like "name".
+ """
+ return self._gerrit_change_owner
+
def _ensure_gerrit_change_info(self):
"""Initializes extra info about gerrit_change, fetched from Gerrit server.
@@ -69,6 +79,9 @@ class TryserverApi(recipe_api.RecipeApi):
cl.change % 100, cl.change, cl.patchset),
},
},
+ 'owner': {
+ 'name': 'John Doe',
+ },
}]
res = self.m.gerrit.get_changes(
host='https://' + cl.host,
@@ -91,6 +104,7 @@ class TryserverApi(recipe_api.RecipeApi):
if int(rev['_number']) == self.gerrit_change.patchset:
self._gerrit_change_fetch_ref = rev['ref']
break
+ self._gerrit_change_owner = res['owner']
self._gerrit_info_initialized = True
@property
diff --git a/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json b/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json
index b7e2541a1..a833bd7cd 100644
--- a/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json
+++ b/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"1\", @@@",
diff --git a/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json b/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json
index d2edfe91f..dc704b72c 100644
--- a/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json
+++ b/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json
@@ -28,6 +28,9 @@
"@@@STEP_LOG_LINE@json.output@[@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"branch\": \"refs/heads/experiment\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"owner\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"John Doe\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"_number\": \"1\", @@@",
diff --git a/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.expected/basic.json b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.expected/basic.json
new file mode 100644
index 000000000..b6042b610
--- /dev/null
+++ b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.expected/basic.json
@@ -0,0 +1,5 @@
+[
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py
new file mode 100644
index 000000000..5bbd7c5b3
--- /dev/null
+++ b/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py
@@ -0,0 +1,22 @@
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from recipe_engine import post_process
+
+DEPS = [
+ 'recipe_engine/buildbucket',
+ 'gerrit',
+ 'tryserver',
+]
+
+
+def RunSteps(api):
+ api.tryserver.gerrit_change_owner
+
+
+def GenTests(api):
+ yield api.test(
+ 'basic',
+ api.buildbucket.try_build()
+ )