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

Unified Diff: scripts/slave/recipe_modules/trigger/example.py

Issue 966993002: api.trigger: refactoring, made extensible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: fixes Created 5 years, 10 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
Index: scripts/slave/recipe_modules/trigger/example.py
diff --git a/scripts/slave/recipe_modules/trigger/example.py b/scripts/slave/recipe_modules/trigger/example.py
index 0f36ce1e6257453610b7f0e5612df9476a0bc4d0..419980fd4753b704c48b0dbb59780b5df5b4dbf2 100644
--- a/scripts/slave/recipe_modules/trigger/example.py
+++ b/scripts/slave/recipe_modules/trigger/example.py
@@ -10,44 +10,52 @@ DEPS = [
def GenSteps(api):
- def normalize_properties(props):
- props = dict(props)
- if 'buildbot.changes' in props:
- props['buildbot.changes'] = list(props['buildbot.changes'])
- return props
+ def normalize_specs(specs):
+ specs = dict(specs)
+ if 'buildbot_changes' in specs:
+ specs['buildbot_changes'] = map(dict, specs['buildbot_changes'])
+ return specs
- prop_list = map(normalize_properties, api.properties['trigger_props_list'])
- api.trigger(*prop_list)
+ specs = map(normalize_specs, api.properties['trigger_specs'])
+ api.trigger(*specs)
def GenTests(api):
yield (
api.test('trigger_one_build') +
- api.properties(trigger_props_list=[{
- 'buildername': 'cross-compiler',
- 'a': 1,
+ api.properties(trigger_specs=[{
+ 'builder_name': 'cross-compiler',
+ 'properties': {'a': 1},
}])
)
yield (
api.test('trigger_two_builds') +
- api.properties(trigger_props_list=[{
- 'buildername': 'cross-compiler',
- 'a': 1,
+ api.properties(trigger_specs=[{
+ 'builder_name': 'cross-compiler',
+ 'properties': {'a': 1},
}, {
- 'buildername': 'cross-compiler',
- 'a': 2,
+ 'builder_name': 'cross-compiler',
+ 'properties': {'a': 2},
}])
)
yield (
- api.test('buildbot.changes') +
- api.properties(trigger_props_list=[{
- 'buildername': 'cross-compiler',
- 'buildbot.changes': [{
+ api.test('buildbot_changes') +
+ api.properties(trigger_specs=[{
+ 'builder_name': 'cross-compiler',
+ 'buildbot_changes': [{
'author': 'someone@chromium.org',
'revision': 'deadbeef',
'comments': 'hello world!',
}],
}])
)
+
+ yield (
+ api.test('backward_compatibility') +
+ api.properties(trigger_specs=[{
+ 'buildername': 'cross-compiler',
+ 'a': 1,
+ }])
+ )

Powered by Google App Engine
This is Rietveld 408576698