Buildbot + Mozilla

Over the past year or so Mozilla has increasingly relied on Buildbot for our Building, Releasing, Testing, and l10n processes. For awhile, everyone that touched Buildbot did things their own way. As a result we had a ton of code (and bug) duplication. There is now a heavy push within the Release Engineering group to rectify this. We've slowly but surely been moving code into our "buildbotcustom". This module contains many different things that are not appropriate to put in upstream-Buildbot, but are very appropriate and useful to those working with Mozilla. We've done our best to keep things as generic as possible. Some things (tryserver and unittest) were moved as-is into buildbotcustom to make it easier to generalize them in the future.

The rest of this post is aimed towards people who want to build Mozilla products with Buildbot and talks about some of the custom classes in more detail.

Change Sources

TinderboxPoller

TinderboxPoller watches a Tinderbox quickparse file (such as http://tinderbox.mozilla.org/Firefox/quickparse.txt) for new builds from a specific builder (each column on the Tinderbox waterfall is a builder). When a new build is detected it kicks off a "build" (which isn't necessarily a compilation process) on the specified "branch" (which in this case is simply a string that matches the TinderboxPoller to a specific builder or builders. For example, we have a TinderboxPoller that watches fx-linux-tbox for new builds. Whenever it sees one it kicks off Talos runs ("builds") on a number of different machines. To the best of my knowledge, the only thing we use this for is Talos - but there may be things I'm unaware of.

Build Steps

TinderboxShellCommand

This is a BuildStep that simply executes a regular Buildbot ShellCommand and ignores the result. Those familiar with Tinderbox client will understand the naming of it.

GetBuildID

This step attempts to pull the BuildID from the objdir of a build and set it as a BuildProperty. It does so through printconfigsetting.py and application.ini. If you are using an objdir you must pass the path to it, relative to the builddir. If you are not using one you do not need to pass anything. Once this step is run you can refer to it through WithProperties.

SetMozillaBuildProperties

This step does the job of GetBuildID and more (oh so much more). However, it depends on a slave-side command that is only in Mozilla's Buildbot tree. To use it, you must be using Buildbot checked out from mozilla/tools/buildbot. (Technically, you could copy and paste the slave command into an upstream Buildbot, but let's keep it simple). In addition to gathering the BuildID and setting it as a BuildProperty it does the same for the following: appVersion (from application.ini, falling back on platform.ini), the filename, size (in bytes), and sha1 hash of the package, installer, and complete mar are gathered. Please see the in-code documentation for the names of the BuildProperties. Obviously, this step should not be run until the package and/or installer and/or complete mar are created, if you care about their metadata.

As with GetBuildID it needs to know where the objdir is rooted (relative to builddir). Again, if there is no objdir you can simply ignore this parameter.

MozillaStageUpload

(I'm not sure how useful this is to non-Firefox projects as it contains some business logic that may be specific to Fx, but it performs an important function so I figure I'll include it here.)

This is a bit of a kludgy class as it ends up generating one huge line of bash that gets executed. It was written to be a replacement for the

Tinderbox client 'pushit()' function. It's job is simple: upload packages and mars to a server (for example, stage.mozilla.org). Because it was written to replicate some Tinderbox logic it's got a lot of different options that I don't need to go through here. The in-code documentation for it is quite complete and available here: http://mxr.mozilla.org/mozilla/source/tools/buildbotcustom/steps/transfer.py

One note: your BuildSlaves will need passwordless logins to remoteHost with the ssh host key accepted, or else this step will hang. You can test this by doing 'ssh username@remoteHost' on your slaves.

In the coming weeks I intend to write a few more posts about Mozilla's Buildbot usage.

Comments

Comments powered by Disqus