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

Side by Side Diff: scripts/slave/recipe_modules/trigger/api.py

Issue 973703002: Buildbucket-based build triggering API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: 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
« no previous file with comments | « scripts/slave/recipe_modules/step/config.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """This recipe module allows triggering builds within the same master. 5 """This recipe module allows triggering builds within the same master.
6 6
7 Example: 7 Example:
8 api.trigger({ 8 api.trigger({
9 'buildername': 'My Builder', 9 'buildername': 'My Builder',
10 'another_property': 'value', 10 'another_property': 'value',
(...skipping 28 matching lines...) Expand all
39 'properties': props, 39 'properties': props,
40 } 40 }
41 41
42 def __call__(self, *trigger_specs, **kwargs): 42 def __call__(self, *trigger_specs, **kwargs):
43 """Triggers new builds by builder names. 43 """Triggers new builds by builder names.
44 44
45 Args: 45 Args:
46 trigger_specs: a list of trigger dicts, where each dict specifies a build 46 trigger_specs: a list of trigger dicts, where each dict specifies a build
47 to trigger. Supported keys: 47 to trigger. Supported keys:
48 builder_name (str): in BuildBot context, builder name 48 builder_name (str): in BuildBot context, builder name
49 bucket (str): buildbucket bucket where the triggered builds will be
50 placed.
49 properties (dict): build properties for a new build. 51 properties (dict): build properties for a new build.
50 buildbot_changes (list of dict): list of Buildbot changes to create. 52 buildbot_changes (list of dict): list of Buildbot changes to create.
51 See below. 53 See below.
52 name: name of the step. If not specified, it is generated 54 name: name of the step. If not specified, it is generated
53 automatically. Its format may change in future. 55 automatically. Its format may change in future.
54 56
55 Buildbot changes: 57 Buildbot changes:
56 buildbot_changes (a list of dicts) is a list of changes for the 58 buildbot_changes (a list of dicts) is a list of changes for the
57 triggered builds. Each change is a dict with keys (all optional): 59 triggered builds. Each change is a dict with keys (all optional):
58 author (str) 60 author (str)
59 revision 61 revision
60 revlink (str): link to a web view of the revision. 62 revlink (str): link to a web view of the revision.
61 comment 63 comment
62 when_timestamp (int): timestamp of the change, in seconds since Unix 64 when_timestamp (int): timestamp of the change, in seconds since Unix
63 Epoch. 65 Epoch.
64 branch 66 branch
65 category (str): Buildbot change category 67 category (str): Buildbot change category
66 files (list of str): list of changed filenames 68 files (list of str): list of changed filenames
67 The first change is used to populate source stamp properties. 69 The first change is used to populate source stamp properties.
68 70
69 Examples: 71 Examples:
70 Basic: 72 Basic:
71 api.trigger({ 73 api.trigger({
72 'builder_name': 'Release', 74 'builder_name': 'Release',
73 'properties': { 75 'properties': {
74 'my_prop': 123, 76 'my_prop': 123,
75 }, 77 },
76 }) 78 })
77 79
80 Using BuildBucket:
81 api.trigger({
82 'builder_name': 'Release',
83 'bucket': 'master.tryserver.chromium.linux',
84 'properties': {
85 'my_prop': 123,
86 },
87 })
88
78 Create Buildbot changes: 89 Create Buildbot changes:
79 api.trigger({ 90 api.trigger({
80 'builder_name': 'Release', 91 'builder_name': 'Release',
81 'buildbot_changes': [{ 92 'buildbot_changes': [{
82 'author': 'someone@chromium.org', 93 'author': 'someone@chromium.org',
83 'branch': 'master', 94 'branch': 'master',
84 'files': ['a.txt.'], 95 'files': ['a.txt.'],
85 'comments': 'Refactoring', 96 'comments': 'Refactoring',
86 'revision': 'deadbeef', 97 'revision': 'deadbeef',
87 'revlink': 98 'revlink':
(...skipping 13 matching lines...) Expand all
101 assert builder_name, 'builder_name is missing: %s' % (trigger,) 112 assert builder_name, 'builder_name is missing: %s' % (trigger,)
102 builder_names.add(builder_name) 113 builder_names.add(builder_name)
103 114
104 name = ( 115 name = (
105 kwargs.get('name') or ('trigger %s' % ', '.join(sorted(builder_names)))) 116 kwargs.get('name') or ('trigger %s' % ', '.join(sorted(builder_names))))
106 return self.m.step( 117 return self.m.step(
107 name, 118 name,
108 cmd=[], 119 cmd=[],
109 trigger_specs=trigger_specs, 120 trigger_specs=trigger_specs,
110 ) 121 )
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/step/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698