OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # ex: set syntax=python: | 2 # ex: set syntax=python: |
3 | 3 |
4 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 4 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 # This is the buildmaster config file for the 'chromeos' bot. It must | 8 # These modules come from scripts/master, which must be in the PYTHONPATH. |
9 # be installed as 'master.cfg' in your buildmaster's base directory | 9 import master.cros_builder_mapping as cros_builder_mapping |
10 # (although the filename can be changed with the --basedir option to | 10 # Perform reload so a 'make reconfig' picks up changes to cros_builder_mapping |
11 # 'mktap buildbot master'). | 11 reload(cros_builder_mapping) |
12 | 12 |
13 # It has one job: define a dictionary named BuildmasterConfig. This | |
14 # dictionary has a variety of keys to control different aspects of the | |
15 # buildmaster. They are documented in docs/config.xhtml . | |
16 | |
17 from buildbot.changes import svnpoller | |
18 from buildbot.changes.pb import PBChangeSource | |
19 from buildbot.scheduler import Dependent | |
20 from buildbot.scheduler import Periodic | |
21 from buildbot.scheduler import Scheduler | |
22 from buildbot.scheduler import Triggerable | |
23 | |
24 # These modules come from scripts/master, which must be in the PYTHONPATH. | |
25 from master import build_utils | |
26 from master import master_utils | 13 from master import master_utils |
27 from master import slaves_list | 14 from master import slaves_list |
| 15 from master.cros_builders_pools import CrOSBuildersPools |
| 16 from master.cros_try_job_git import CrOSTryJobGit |
28 from master.factory import chromeos_factory | 17 from master.factory import chromeos_factory |
29 | 18 |
30 # These modules come from scripts/common, which must be in the PYTHONPATH. | 19 # These modules come from scripts/common, which must be in the PYTHONPATH. |
31 import config | 20 import config |
32 | 21 |
33 ActiveMaster = config.Master.ChromiumOS | 22 ActiveMaster = config.Master.ChromiumOSTryServer |
34 | |
35 TREE_GATE_KEEPER = ActiveMaster.is_production_host | |
36 GOOD_REVISIONS = False | |
37 | 23 |
38 # This is the dictionary that the buildmaster pays attention to. We also use | 24 # This is the dictionary that the buildmaster pays attention to. We also use |
39 # a shorter alias to save typing. | 25 # a shorter alias to save typing. |
40 c = BuildmasterConfig = {} | 26 c = BuildmasterConfig = {} |
41 | 27 |
42 # This is a dictionary that maps waterfall dashboard names to cbuildbot_configs. | 28 ####### CHANGESOURCES |
43 # In order to add a new dict, you must edit this first. | |
44 _NAME_CONFIG_DICT = { | |
45 'x86 generic PFQ': 'x86-generic-pre-flight-queue', | |
46 'x86 generic commit queue': 'x86-generic-commit-queue', | |
47 'arm generic PFQ': 'arm-generic-bin', | |
48 'tegra2 PFQ': 'arm-tegra2-bin', | |
49 'x86 generic full': 'x86-generic-full', | |
50 'arm generic full': 'arm-generic-full', | |
51 'tegra2 full': 'arm-tegra2-full', | |
52 'tegra2 seaboard full': 'arm-tegra2-seaboard-full', | |
53 'x86 pineview full': 'x86-pineview-full', | |
54 'x86 generic chrome PFQ': 'x86-generic-chrome-pre-flight-queue', | |
55 'arm generic chrome PFQ': 'arm-generic-chrome-pre-flight-queue', | |
56 'tegra2 chrome PFQ': 'arm-tegra2-chrome-pre-flight-queue', | |
57 'chromiumos sdk': 'chromiumos-sdk', | |
58 'refresh packages': 'refresh-packages', | |
59 'x86 generic ASAN': 'x86-generic-asan', | |
60 } | |
61 | 29 |
62 ####### CHANGESOURCES | 30 c['change_source'] = [] |
63 def ChromeTreeFileSplitter(path): | |
64 """split_file for chrome tree changes; return None for uninteresting paths.""" | |
65 # List of projects we are interested in. The project names must exactly | |
66 # match paths in the Subversion repository, relative to the 'path' URL | |
67 # argument. build_utils.SplitPath() will use them as branch names to | |
68 # kick off the Schedulers for different projects. | |
69 projects = ['releases'] | |
70 return build_utils.SplitPath(projects, path) | |
71 | 31 |
| 32 ####### BUILDERS |
72 | 33 |
73 chromium_rev = 'http://src.chromium.org/viewvc/chrome?view=rev&revision=%s' | 34 c['builders'] = [] |
74 | 35 pools = CrOSBuildersPools(default_pool_name='ChromeOS', |
75 chrome_trunk_poller = svnpoller.SVNPoller( | 36 builder_mapping=cros_builder_mapping.CONFIG_NAME_DICT) |
76 svnurl='svn://svn.chromium.org/chrome/', | |
77 split_file=ChromeTreeFileSplitter, | |
78 pollinterval=300, | |
79 revlinktmpl=chromium_rev) | |
80 | |
81 pb_source = PBChangeSource() | |
82 | |
83 c['change_source'] = [pb_source, chrome_trunk_poller] | |
84 | |
85 _TOOLCHAIN_TARGETS = ['amd64-generic-full'] | |
86 _TOOLCHAIN_TARGETS_CLOSER = ['arm-tegra2-seaboard-toolchain', | |
87 'x86-generic-gcc_46', | |
88 'arm-tegra2-seaboard-gcc_46'] | |
89 | |
90 ####### SCHEDULERS | |
91 | |
92 ## configure the Schedulers | |
93 | |
94 # Pre-flight scheduler for changes in Chromium OS. All other slaves are either | |
95 # triggered or depend on this scheduler. | |
96 # XXX: Changes to builderNames must also be made in:# - slaves.cfg | |
97 # - public_html/announce.html | |
98 # - And down below in the builder definitions as well | |
99 # - and you probably need to restart any changed slaves as well as the master | |
100 s_chromiumos_sdk = Scheduler( | |
101 name='sdk_scheduler', | |
102 # Renamed 'src' to 'master' for git_buildbot.py | |
103 branch='master', | |
104 treeStableTimer=0, | |
105 builderNames=[ | |
106 'chromiumos sdk', | |
107 ]) | |
108 | |
109 s_refresh_packages = Periodic( | |
110 name='refresh_pkgs_scheduler', | |
111 branch='master', | |
112 periodicBuildTimer=24*60*60, # 1 day | |
113 builderNames=[ | |
114 'refresh packages', | |
115 ]) | |
116 | |
117 s_cq = Periodic( | |
118 name='commit_queue_scheduler', | |
119 branch='master', | |
120 periodicBuildTimer=5*60, # 5 minutes | |
121 builderNames=[ | |
122 'x86 generic commit queue', | |
123 ]) | |
124 | |
125 s_asan = Periodic( | |
126 name='x86_generic_asan_scheduler', | |
127 branch='master', | |
128 periodicBuildTimer=5*60, # 5 minutes | |
129 builderNames=[ | |
130 'x86 generic ASAN', | |
131 ]) | |
132 | |
133 s_pre_flight_queue = Scheduler( | |
134 name='pre_flight_queue', | |
135 # Renamed 'src' to 'master' for git_buildbot.py | |
136 branch='master', | |
137 treeStableTimer=0, | |
138 builderNames=[ | |
139 'x86 generic PFQ', | |
140 ]) | |
141 | |
142 # Pre-flight scheduler for deps changes of Chromium for Chromium OS. | |
143 s_chrome_pre_flight_queue = Scheduler( | |
144 name='chrome_pre_flight_queue', | |
145 branch='releases', | |
146 treeStableTimer=0, | |
147 builderNames=[ | |
148 'x86 generic chrome PFQ', | |
149 ]) | |
150 | |
151 # Triggerable for chrome-pre-flight-queue-slaves. All chrome PFQ's should be | |
152 # triggered from master chrome pfq. | |
153 s_chrome_pre_flight_queue_slaves = Triggerable( | |
154 name='chrome_pre_flight_queue_slaves', | |
155 builderNames=[ | |
156 'arm generic chrome PFQ', | |
157 'tegra2 chrome PFQ', | |
158 ]) | |
159 | |
160 # Triggerable for other pre-flight-queue slaves. We use triggers so that | |
161 # the other slaves are guaranteed to use the same sourcestamp as the main. | |
162 s_pre_flight_queue_slaves = Triggerable( | |
163 name='pre_flight_queue_slaves', | |
164 builderNames=[ | |
165 'arm generic PFQ', | |
166 'tegra2 PFQ', | |
167 ]) | |
168 | |
169 # Only trigger fulls when we have a newly revved build. | |
170 s_chromeos_full = Dependent( | |
171 name='chromeos', | |
172 upstream=s_pre_flight_queue, | |
173 builderNames=[ | |
174 'arm generic full', | |
175 'tegra2 full', | |
176 'tegra2 seaboard full', | |
177 'x86 generic full', | |
178 'x86 pineview full', | |
179 ] + _TOOLCHAIN_TARGETS) | |
180 | |
181 c['schedulers'] = [ | |
182 s_pre_flight_queue, s_pre_flight_queue_slaves, | |
183 s_chrome_pre_flight_queue, s_chrome_pre_flight_queue_slaves, | |
184 s_chromeos_full, s_chromiumos_sdk, | |
185 s_refresh_packages, s_cq, s_asan, | |
186 ] | |
187 | |
188 BUILDERS = [] | |
189 | 37 |
190 # ---------------------------------------------------------------------------- | 38 # ---------------------------------------------------------------------------- |
191 # BUILDER DEFINITIONS | 39 # BUILDER DEFINITIONS |
192 | 40 |
193 # The 'builders' list defines the Builders. Each one is configured with a | 41 # The 'builders' list defines the Builders. Each one is configured with a |
194 # dictionary, using the following keys: | 42 # dictionary, using the following keys: |
195 # name (required): the name used to describe this bilder | 43 # name (required): the name used to describe this bilder |
196 # slavename (required): which slave to use, must appear in c['slaves'] | 44 # slavename (required): which slave to use, must appear in c['slaves'] |
197 # builddir (required): which subdirectory to run the builder in | 45 # builddir (required): which subdirectory to run the builder in |
198 # factory (required): a BuildFactory to define how the build is run | 46 # factory (required): a BuildFactory to define how the build is run |
199 # category (optional): it is not used in the normal 'buildbot' meaning. It is | 47 # category (optional): it is not used in the normal 'buildbot' meaning. It is |
200 # used by gatekeeper to determine which steps it should | 48 # used by gatekeeper to determine which steps it should |
201 # look for to close the tree. | 49 # look for to close the tree. |
202 # | 50 # |
203 | 51 |
204 # Cros helper functions to build builders and factories. | 52 # Cros helper functions to build builders and factories. |
205 | 53 |
206 def GetCBuildbotFactory(config, is_master=False): | 54 def GetCBuildbotFactory(config): |
207 """Returns cros buildbot factories.""" | 55 """Returns cros buildbot factories.""" |
208 return chromeos_factory.CbuildbotFactory( | 56 return chromeos_factory.CbuildbotFactory( |
209 params=config, dry_run=not ActiveMaster.is_production_host, | 57 params=config, trybot=True, crostools_repo=None).get_factory() |
210 crostools_repo=None, | |
211 is_master=is_master).get_factory() | |
212 | 58 |
213 def GetChromeCBuildbotFactory(config, is_master=False): | |
214 """Returns buildbot factories specifically for Chrome pfqs.""" | |
215 return chromeos_factory.ChromeCbuildbotFactory( | |
216 params=config, chrome_rev_stages=[], | |
217 dry_run=not ActiveMaster.is_production_host, | |
218 crostools_repo=None, | |
219 is_master=is_master).get_factory() | |
220 | 59 |
221 def AddBuilderDefinition(display_name, closer=True, chrome_factory=False, | 60 def AddBuilderDefinition(display_name): |
222 is_master=False): | |
223 """Adds a builder definition given by the args. | 61 """Adds a builder definition given by the args. |
224 | 62 |
225 Args: | 63 Args: |
226 display_name: Name displayed on buildbot waterfall. | 64 display_name: Name displayed on buildbot waterfall. |
227 closer: Do we close the tree based on this build's failure. | |
228 chrome_factory: Use the chrome factory rather than normal factory. | |
229 is_master: One set per pfq type. | |
230 """ | 65 """ |
231 def GetConfig(): | 66 def GetConfig(): |
232 return _NAME_CONFIG_DICT.get(display_name, display_name) | 67 return cros_builder_mapping.NAME_CONFIG_DICT.get(display_name, display_name) |
233 | 68 |
234 category = '1release full|info' | 69 c['builders'].append({ |
235 if closer: category = '1release full|closer' | |
236 build_dir = display_name.replace(' ', '-') | |
237 if chrome_factory: | |
238 factory = GetChromeCBuildbotFactory(GetConfig(), is_master) | |
239 else: | |
240 factory = GetCBuildbotFactory(GetConfig(), is_master) | |
241 | |
242 BUILDERS.append({ | |
243 'name': display_name, | 70 'name': display_name, |
244 'builddir': build_dir, | 71 'builddir': display_name.replace(' ', '-'), |
245 'factory': factory, | 72 'factory': GetCBuildbotFactory(GetConfig()), |
246 'category': category, | 73 'category': '1release full|info', |
247 }) | 74 }) |
248 | 75 |
| 76 pools['ChromeOS'].append(display_name) |
| 77 |
| 78 |
249 # Pre Flight Queues | 79 # Pre Flight Queues |
250 AddBuilderDefinition('x86 generic PFQ', is_master=True) | 80 AddBuilderDefinition('x86 generic PFQ') |
251 AddBuilderDefinition('arm generic PFQ') | 81 AddBuilderDefinition('arm generic PFQ') |
252 AddBuilderDefinition('tegra2 PFQ') | 82 AddBuilderDefinition('tegra2 PFQ') |
253 | 83 |
254 # Full Builders | 84 # Full Builders |
255 AddBuilderDefinition('x86 generic full') | 85 AddBuilderDefinition('x86 generic full') |
256 AddBuilderDefinition('arm generic full') | 86 AddBuilderDefinition('arm generic full') |
257 AddBuilderDefinition('tegra2 full') | 87 AddBuilderDefinition('tegra2 full') |
258 AddBuilderDefinition('tegra2 seaboard full') | 88 AddBuilderDefinition('tegra2 seaboard full') |
259 AddBuilderDefinition('x86 pineview full') | 89 AddBuilderDefinition('x86 pineview full') |
260 | 90 |
261 # Chrome pre-flight builds. | |
262 AddBuilderDefinition('x86 generic chrome PFQ', chrome_factory=True, | |
263 is_master=True) | |
264 AddBuilderDefinition('arm generic chrome PFQ', chrome_factory=True,) | |
265 AddBuilderDefinition('tegra2 chrome PFQ', chrome_factory=True,) | |
266 | |
267 AddBuilderDefinition('chromiumos sdk',) | 91 AddBuilderDefinition('chromiumos sdk',) |
268 | 92 |
269 for builder in _TOOLCHAIN_TARGETS_CLOSER: | |
270 AddBuilderDefinition(builder, closer=True) | |
271 | |
272 ####### Non Closer build defs. | |
273 | |
274 AddBuilderDefinition('x86 generic commit queue', closer=False) | |
275 AddBuilderDefinition('refresh packages', closer=False) | |
276 AddBuilderDefinition('x86 generic ASAN', closer=False) | |
277 | |
278 for builder in _TOOLCHAIN_TARGETS: | |
279 AddBuilderDefinition(builder, closer=False) | |
280 | |
281 c['builders'] = BUILDERS | |
282 | |
283 | |
284 ####### BUILDSLAVES | 93 ####### BUILDSLAVES |
285 | 94 |
286 # the 'slaves' list defines the set of allowable buildslaves. Each element is a | 95 # the 'slaves' list defines the set of allowable buildslaves. Each element is a |
287 # tuple of bot-name and bot-password. These correspond to values given to the | 96 # tuple of bot-name and bot-password. These correspond to values given to the |
288 # buildslave's mktap invocation. | 97 # buildslave's mktap invocation. |
289 | 98 |
290 # First, load the list from slaves.cfg. | 99 # First, load the list from slaves.cfg. |
291 slaves = slaves_list.SlavesList('slaves.cfg', 'ChromiumOS') | 100 slaves = slaves_list.SlavesList('slaves.cfg', 'ChromiumOSTryServer') |
292 | 101 |
293 # Associate the slaves to the builders. | 102 # Associate the slaves to the builders. |
294 for builder in c['builders']: | 103 for builder in c['builders']: |
295 builder['slavenames'] = slaves.GetSlavesName(builder=builder['name']) | 104 builder['slavenames'] = slaves.GetSlavesName(builder=builder['name']) |
296 # Don't enable auto_reboot for people testing locally. | 105 # Don't enable auto_reboot for people testing locally. |
297 builder.setdefault('auto_reboot', ActiveMaster.is_production_host) | 106 builder.setdefault('auto_reboot', ActiveMaster.is_production_host) |
298 | 107 |
299 # The 'slaves' list defines the set of allowable buildslaves. List all the | 108 # The 'slaves' list defines the set of allowable buildslaves. List all the |
300 # slaves registered to a builder. Remove dupes. | 109 # slaves registered to a builder. Remove dupes. |
301 c['slaves'] = master_utils.AutoSetupSlaves(c['builders'], | 110 c['slaves'] = master_utils.AutoSetupSlaves(c['builders'], |
302 config.Master.GetBotPassword()) | 111 config.Master.GetBotPassword()) |
303 | 112 |
| 113 ####### SCHEDULERS |
| 114 |
| 115 c['schedulers'] = [] |
| 116 |
| 117 c['schedulers'].append(CrOSTryJobGit( |
| 118 name='cros_try_job_git', |
| 119 pools=pools, |
| 120 repo_url=ActiveMaster.repo_url |
| 121 )) |
304 | 122 |
305 ####### STATUS TARGETS | 123 ####### STATUS TARGETS |
306 | 124 |
307 # Adds common status and tools to this master. | 125 # Adds common status and tools to this master. |
308 master_utils.AutoSetupMaster(c, ActiveMaster, order_console_by_time=True) | 126 master_utils.AutoSetupMaster(c, ActiveMaster, order_console_by_time=True) |
309 | 127 |
310 # Add more. | 128 # Add a dumb MailNotifier first so it will be used for BuildSlave with |
| 129 # notify_on_missing set when they go missing. |
| 130 from buildbot.status import mail |
| 131 c['status'].append(mail.MailNotifier( |
| 132 fromaddr=ActiveMaster.from_address, |
| 133 builders=[], |
| 134 relayhost=config.Master.smtp, |
| 135 lookup=master_utils.UsersAreEmails())) |
311 | 136 |
312 if TREE_GATE_KEEPER: | 137 # Try job result emails. |
313 from master import gatekeeper | 138 from master.try_mail_notifier import TryMailNotifier |
314 # This is the list of the builder categories and the corresponding critical | 139 c['status'].append(TryMailNotifier( |
315 # steps. If one critical step fails, gatekeeper will close the tree | 140 fromaddr=ActiveMaster.from_address, |
316 # automatically. | 141 subject="try %(result)s for %(reason)s on %(builder)s", |
317 # Note: don't include 'update scripts' since we can't do much about it when | 142 mode='all', |
318 # it's failing and the tree is still technically fine. | 143 relayhost=config.Master.smtp, |
319 categories_steps = { | 144 lookup=master_utils.UsersAreEmails())) |
320 'closer': [ | |
321 'update', 'configure build', 'setup mirrors', 'update chroot', | |
322 'setup board', 'build packages', 'run tests', | |
323 'build image', 'create qemu image', 'run smoke bvt', 'archived build', | |
324 'cbuildbot', 'cbuildbot_master', 'cbuildbot_chrome_latest_release', | |
325 ], | |
326 'info': [ | |
327 ], | |
328 '': [ | |
329 ], | |
330 } | |
331 exclusions = {} | |
332 # TODO: convert GateKeeper to 'use_getname=True' | |
333 # 1) set names for all steps in categories_steps | |
334 # 2) update categories_steps to use names insteads of description | |
335 # 3) change forgiving_steps to: | |
336 # forgiving_steps = ['update_scripts', 'update', 'archive_build'] | |
337 # 4) add 'use_getname=True' to the GateKeeper call | |
338 forgiving_steps = ['update scripts', 'update', 'archived build'] | |
339 c['status'].append(gatekeeper.GateKeeper( | |
340 fromaddr=ActiveMaster.from_address, | |
341 categories_steps=categories_steps, | |
342 exclusions=exclusions, | |
343 relayhost=config.Master.smtp, | |
344 subject='buildbot %(result)s in %(projectName)s on %(builder)s, ' | |
345 'revision %(revision)s', | |
346 extraRecipients=ActiveMaster.tree_closing_notification_recipients, | |
347 lookup=master_utils.FilterDomain(), | |
348 forgiving_steps=forgiving_steps, | |
349 tree_status_url=ActiveMaster.tree_status_url, | |
350 check_revisions=False)) | |
351 | |
352 if GOOD_REVISIONS: | |
353 # TODO: update for ChromeOS | |
354 from master import goodrevisions | |
355 # This is the list of builders with their respective list of critical steps | |
356 # that all need to succeed to mark a revision as successful. A single failure | |
357 # in any of the steps of any of the builders will mark the revision as failed. | |
358 good_revision_steps = { | |
359 'XP Tests (dbg)(2)': ['unit_tests'], | |
360 'Mac10.5 Tests (dbg)(2)': ['unit_tests'], | |
361 'Chromium Linux': ['unit_tests'], | |
362 } | |
363 c['status'].append(goodrevisions.GoodRevisions( | |
364 good_revision_steps=good_revision_steps)) | |
365 | |
366 | |
367 ####### TROOPER NAGGING | |
368 if ActiveMaster.is_production_host: | |
369 from master import chromium_notifier | |
370 categories_steps = { | |
371 'closer': [ | |
372 'CleanUp', 'LKGMCandidateSync', 'Sync', 'Uprev', 'UploadPrebuilts', | |
373 'Archive', 'PublishUprevChanges' | |
374 ] | |
375 } | |
376 | |
377 c['status'].append(chromium_notifier.ChromiumNotifier( | |
378 fromaddr=ActiveMaster.from_address, | |
379 categories_steps=categories_steps, | |
380 relayhost=config.Master.smtp, | |
381 status_header='%(steps)s failed on "%(builder)s"', | |
382 subject='buildbot trooper alert on %(builder)s (%(projectName)s)', | |
383 extraRecipients=['troopers@chromium.org'], | |
384 send_to_sheriffs=True, | |
385 lookup=master_utils.FilterDomain(), | |
386 use_getname=True)) | |
387 | 145 |
388 | 146 |
389 ####### PROJECT IDENTITY | 147 ####### PROJECT IDENTITY |
390 | 148 |
391 # Buildbot master url: | 149 # Buildbot master url: |
392 c['buildbotURL'] = 'http://build.chromium.org/buildbot/chromiumos/' | 150 c['buildbotURL'] = '' |
OLD | NEW |