Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: appengine/cr-buildbucket/swarming/swarming.py

Issue 2044253002: swarmbucket: add support for blamelist (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: fix coverage Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/cr-buildbucket/swarming/test/swarming_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cr-buildbucket/swarming/swarming.py
diff --git a/appengine/cr-buildbucket/swarming/swarming.py b/appengine/cr-buildbucket/swarming/swarming.py
index 00d7cad60a23fd7633a35767927a52af6a3af6a1..405821b18d9c2a4bf54316a43876b64139eb7db8 100644
--- a/appengine/cr-buildbucket/swarming/swarming.py
+++ b/appengine/cr-buildbucket/swarming/swarming.py
@@ -51,6 +51,7 @@ PUBSUB_TOPIC = 'swarming'
BUILDER_PARAMETER = 'builder_name'
PARAM_PROPERTIES = 'properties'
PARAM_SWARMING = 'swarming'
+PARAM_CHANGES = 'changes'
DEFAULT_URL_FORMAT = 'https://{swarming_hostname}/user/task/{task_id}'
@@ -132,6 +133,10 @@ def validate_build_parameters(builder_name, params):
def create_task_def_async(swarming_cfg, builder_cfg, build):
"""Creates a swarming task definition for the |build|.
+ Supports build properties that are supported by Buildbot-Buildbucket
+ integration. See
+ https://chromium.googlesource.com/chromium/tools/build/+/eff4ceb/scripts/master/buildbucket/README.md#Build-parameters
+
Raises:
errors.InvalidInputError if build.parameters are invalid.
"""
@@ -156,6 +161,13 @@ def create_task_def_async(swarming_cfg, builder_cfg, build):
build_properties.update(build.parameters.get(PARAM_PROPERTIES) or {})
build_properties['buildername'] = builder_cfg.name
+ # Convert changes in build to blamelist property, like Buildbot-Buildbucket
+ # integration. In Buildbot the property value is a list of emails.
+ changes = params.get(PARAM_CHANGES)
+ if changes: # pragma: no branch
+ emails = [c.get('author', {}).get('email') for c in changes]
+ build_properties['blamelist'] = filter(None, emails)
+
task_template_params.update({
'repository': recipe.repository,
'revision': revision,
« no previous file with comments | « no previous file | appengine/cr-buildbucket/swarming/test/swarming_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698