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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 DEPS = [ 5 DEPS = [
6 'properties', 6 'properties',
7 'trigger' 7 'trigger'
8 ] 8 ]
9 9
10 10
11 def GenSteps(api): 11 def GenSteps(api):
12 12
13 def normalize_properties(props): 13 def normalize_specs(specs):
14 props = dict(props) 14 specs = dict(specs)
15 if 'buildbot.changes' in props: 15 if 'buildbot_changes' in specs:
16 props['buildbot.changes'] = list(props['buildbot.changes']) 16 specs['buildbot_changes'] = map(dict, specs['buildbot_changes'])
17 return props 17 return specs
18 18
19 prop_list = map(normalize_properties, api.properties['trigger_props_list']) 19 specs = map(normalize_specs, api.properties['trigger_specs'])
20 api.trigger(*prop_list) 20 api.trigger(*specs)
21 21
22 22
23 def GenTests(api): 23 def GenTests(api):
24 yield ( 24 yield (
25 api.test('trigger_one_build') + 25 api.test('trigger_one_build') +
26 api.properties(trigger_props_list=[{ 26 api.properties(trigger_specs=[{
27 'buildername': 'cross-compiler', 27 'builder_name': 'cross-compiler',
28 'a': 1, 28 'properties': {'a': 1},
29 }]) 29 }])
30 ) 30 )
31 31
32 yield ( 32 yield (
33 api.test('trigger_two_builds') + 33 api.test('trigger_two_builds') +
34 api.properties(trigger_props_list=[{ 34 api.properties(trigger_specs=[{
35 'buildername': 'cross-compiler', 35 'builder_name': 'cross-compiler',
36 'a': 1, 36 'properties': {'a': 1},
37 }, { 37 }, {
38 'buildername': 'cross-compiler', 38 'builder_name': 'cross-compiler',
39 'a': 2, 39 'properties': {'a': 2},
40 }]) 40 }])
41 ) 41 )
42 42
43 yield ( 43 yield (
44 api.test('buildbot.changes') + 44 api.test('buildbot_changes') +
45 api.properties(trigger_props_list=[{ 45 api.properties(trigger_specs=[{
46 'buildername': 'cross-compiler', 46 'builder_name': 'cross-compiler',
47 'buildbot.changes': [{ 47 'buildbot_changes': [{
48 'author': 'someone@chromium.org', 48 'author': 'someone@chromium.org',
49 'revision': 'deadbeef', 49 'revision': 'deadbeef',
50 'comments': 'hello world!', 50 'comments': 'hello world!',
51 }], 51 }],
52 }]) 52 }])
53 ) 53 )
54
55 yield (
56 api.test('backward_compatibility') +
57 api.properties(trigger_specs=[{
58 'buildername': 'cross-compiler',
59 'a': 1,
60 }])
61 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698