ReleaseEngineering/How To/Setup Personal Development Master

From MozillaWiki
Jump to: navigation, search



  • python 2.7
  • virtualenv
    • If you need to create a virtualenv manually, you must call it directly with:
      python /tools/misc-python/ </path/to/destination>
    • This is not necessary for a buildbot master setup if you use the methods described below

NOTE: You will need root access to create a user account for yourself on dev-master2 and a buildbot area under /builds/buildbot/your_name - if not using root, you might get this error (I think it has to do with which group your account belongs to):

  from twisted.python.zippath import ZipArchive
    ImportError: No module named zippath


  • Instructions specific to dev-master2 (
 # as root
 mkdir /builds/buildbot/${WHO} 
 chown ${WHO} /builds/buildbot/${WHO}
  • Notes:
    • BASEDIR refers to where you want the new master to be created
    • MASTER_NAME is the name of one of the predefined masters. Search for a name prefixed by "staging".
      • display a list of enabled masters: /usr/bin/python2.6 -l
      • display a hardcoded list of 0.8.0 masters: /usr/bin/python2.6 -l -8
    • PYTHON, HG, VIRTUALENV should be adjusted to your local environment

Create a build master

There are two ways to do it:

perl -u aselagea --master-kind=build --master-dir=build1 --http-port=8021
  • following several manual steps:
  • clone the buildbot-configs repository.
$ hg clone
  • add 'try' to the list of ACTIVE_BRANCHES in master/
  • run below
make -f Makefile.setup \
BASEDIR=/builds/buildbot/$USERNAME/build1 \
PYTHON=/tools/python27/bin/python \
VIRTUALENV=virtualenv \
HTTP_PORT=8888 PB_PORT=9999 SSH_PORT=7777 ROLE=build \
virtualenv deps install-buildbot master master-makefile

Universal Master

To create a universal master:

$ cd /builds/buildbot/$USERNAME/build1/master
$ ln -sf ../buildbot-configs/mozilla/universal_master_sqlite.cfg master.cfg

You will probably want to avoid running scheduled builds (nightlies, etc.) from starting on your personal master. Clear the ACTIVE_* lists in mozilla/ to achieve this. You can also set c['schedulers']=[] but take care to do that before the release schedulers are added to the list or sendchange will fail to kick off a release build.

build-master path values

  • Configs: buildbot-configs/mozilla/
  • master_localconfig: ?
  • host: preprod-builder

Signing server setup

Ever since we started signing all builds, a proper signing server setup in your dev master is necessary to do proper tests. The signing servers are configured in and require real secrets (meaning, do not distribute them publicly). The templatized version of will show you the format of the file, but you'll need to get the real values elsewhere. bhearsum's version is generally up-to-date and available at /builds/buildbot/bhearsum/build1/master/ on dev-master2. Note that in staging you must be careful not to use the Release or Nightly signing server instances, which will sign builds with real certificates (instead of self signed ones) -- so do NOT copy a file from a production build master. If you have trouble with this, ask for help.

Disable periodic builds

If you are testing changes on your build master, it can be annoying for pgo builds to be invoked and run on your master consuming your build machine resources. To avoid this, comment out lines that define pgo_strategy like this BRANCHES['mozilla-central']['pgo_strategy'] = 'periodic' or BRANCHES['mozilla-esr31']['pgo_strategy'] = 'per-checkin'. Conversely, if you are testing pgo builds, you can change the start_hour and start_minute on a per branch basis.

Create a tests master

We can create a test master using the same automation script as for a build master:

perl -u aselagea --master-kind=test --master-dir=test1 --http-port=8049

Customize your configs

  • In master/master_config.json, adjust ports for pb_port, http_port & ssh_port
    • Check slavealloc to see what ports are in use by others. Search for 'staging-pers' and be sure to Show all Entries.
    • Try to use similar ports, i.e. if you choose 9099 for pb_port, use 8099 for your http_port and 7099 for your ssh_port.
  • Consider optimizing the number of branches you're running.

Create your own queue dir

To avoid this error:

OSError: [Errno 1] Operation not permitted: '/dev/shm/queue/commands/tmp'

Do this:

 mkdir -p /dev/shm/${WHO}/queue
 chown ${WHO} /dev/shm/${WHO}
  • modify your master/ so that QUEUEDIR points to your new dir:
   QUEUEDIR = "/dev/shm/${WHO}/queue"
  • or (newer) master/master_config.json to add the line:
   "queuedir": "/dev/shm/${WHO}/queue"

Test your buildbot patches

Once you have created a build/test master, you can test various buildbot changes quite easily. Basic steps:

  • clone braindump repo
  • cd to master's home folder && activate the virtual environment
  • make sure 'bb-configs' repo is up-to-date
hg pull; hg update -C
  • compute the initial list of builds/tests
python ../braindump/buildbot-related/ master/master.cfg > old
  • apply your patch
patch -p1 < <patch_name>.patch
  • compute the list of builds/tests following your changes
python ../braindump/buildbot-related/ master/master.cfg > new
:* compute the diff between them
diff -U 0 -p old new
  • make sure your changes are not causing issues on the other masters
bash buildbot-configs/

Does it work?

If you want production schedulers to run, then run the following:

  • build master:
cd $BASEDIR/master; ln -sf ../buildbot-configs/mozilla/universal_master_sqlite.cfg master.cfg; cd -
  • test master:
cd $BASEDIR/master; ln -sf ../buildbot-configs/mozilla-tests/universal_master_sqlite.cfg master.cfg; cd -

Note: the default scheduler builder_master.cfg is usually fine.

  • Read the above as "you always want universal_master_sqlite.cfg unless you have a good and solid reason for not wanting it (or want to test your antacid options).
  • Run "make checkconfig" to make sure the default configs are in place and good.
  • Run "make start" to make sure you master starts.
  • If it works, congrats! Now run "make stop" to shut it down until you're ready to actually start testing.

Adding your master to slavealloc

To lock slaves onto your master you need to add it to slavealloc, see adding a master

Modifying your old master in slavealloc

If you have an old master you can modify it:

Setup/Running local master scheduler on laptop - not dev-master

  1. Download fresh_bb_setup to ~/
  2. bash ./fresh_bb_setup Buildbot
  3. cd Buildbot; source bin/activate
  4. cd buildbot-configs; ./
    • NOTE: you can stop here if your only goal is to test config changes. Make them in this directory, then run ./
  5. cd ~
  6. cd BASEDIR/build-master/
  7. Modify line 2 of Makefile from BUILDBOT=$(PWD)/bin/buildbot to be BUILDBOT=$(PWD)/../bin/buildbot
  8. Modify line 11 of master_config.json so that 'release_branches' contains an empty list. It did contain ["mozilla-1.9.2", "mozilla-beta"] and they are unnecessary for a local setup.
  9. make checkconfig
    • Should say: Config file is good!
  10. make start
    • It will appear as if start has failed, but fear not! You'll see the message below, but this is simply because the buildbot process is launched as a dameon and buildmaster waits to give the all configuration is complete signal. However, Mozilla's configuration files are way to complicated to be dealt with in under 10 seconds, so it times out and you see the message below:
      (Buildbot)localhost:build-master jzeller$ make start
      cd master && /Users/jzeller/Buildbot/build-master/../bin/buildbot  start $PWD
      Following twistd.log until startup finished..
      2014-01-22 14:47:30-0800 [-] Log opened.
      2014-01-22 14:47:30-0800 [-] twistd 12.0.0 (/Users/jzeller/Buildbot/bin/python 2.6.7) starting up.
      2014-01-22 14:47:30-0800 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
      2014-01-22 14:47:30-0800 [-] monkeypatch_twisted_cbLogin applied
      2014-01-22 14:47:30-0800 [-] Creating BuildMaster — buildbot.version: 0.8.2
      2014-01-22 14:47:30-0800 [-] loading configuration from /Users/jzeller/Buildbot/build-master/master.cfg
      2014-01-22 14:47:30-0800 [-] unable to import dnotify, so Maildir will use polling instead
      2014-01-22 14:47:30-0800 [-] nextAWSSlave: start
      2014-01-22 14:47:30-0800 [-] nextAWSSlave: start
      2014-01-22 14:47:37-0800 [-] nextAWSSlave: start
      2014-01-22 14:47:37-0800 [-] nextAWSSlave: start
      The buildmaster took more than 10 seconds to start, so we were unable to
      confirm that it started correctly. Please 'tail twistd.log' and look for a
      line that says 'configuration update complete' to verify correct startup.
      make: *** [start] Error 1
  11. To doublecheck that the configuration was successful, just follow the directions and type: less twistd.log | grep "configuration update complete". Make sure that the most recent timestamp matches the time with which you tried a make start, but as long as you see it pop up then you're good!
  12. Go to http://localhost:8501/
  13. If you see a page with "Welcome to the Buildbot for the Firefox project!" then you have been successful!
  14. You can now check out what buildbot has pending by going to http://localhost:8501/waterfall

Setting up a local slave

cd /path/to/master
source ./bin/activate
buildslave --help

The buildslave command should be available at this point, if not:

pip install buildbot-slave

Now we create a slave using the directory my-slave in the master directory.

  • To find the relevant ports, check master/
  • The port to access your master via the browser is under WebStatus.
  • The port for slave access (used when creating a slave) is under slavePortnum.
  • Choose a slave name that the master is already looking for. To find one go to{browserport}/builders, select a builder (OS X 10.6.2 mozilla-central nightly for example) and choose one of the names under "Buildslaves"
    # From the master's directory
    buildslave create-slave my-slave<port> <name> pass

    If you haven't already, start the master, then start the slave

    cd /path/to/master
    make start
    # Start the slave
    cd my-slave
    buildslave start

    Your slave should be picked up momentarily by the master.

    Pointing dev slaves to your master

    Using the slaves interface of slavealloc (, search for slaves that are currently in the preprod (or preprod-tests) pool that are not currently locked to someone else's dev master. Edit the slave and lock that slave to your master.

    NOTE: the slave will need to be rebooted to pick up this change. If no slaves are available for your required platform, find out who has them all and ask to borrow one.

    Setup a user source repository

    Depending on how invasive your changes are going to be, you can choose to setup your own user repo for any of the releng repos or even the Firefox code repos.

    Follow the instructions for Publishing Mercurial Clones and then replace references to releng repos in the configs with your own repo.

    As of 2012-12-06, you need a mozharness user repo just run b2g compile jobs in staging. It is the only place to change the upload hosts to the staging host.


    • Comment out/change ACTIVE_{BRANCHES,PLATFORMS,PROJECTS} in as needed to reduce your workspace.
      • e.g. I usually run with only one branch: ACTIVE_BRANCHES = ['mozilla-central']


    • Limit the number of platforms your dev-master will run tests on. For instance, if you only want to run tests for Android devices, add this to master_config.json
     "limit_fx_platforms": [],
      "limit_mobile_platforms": [
      "limit_tb_platforms": [],
      "limit_b2g_platforms": [],

    • Update with the appropriate staging passwords so your slaves can connect

    • Update with the STAGING_SLAVES dictionary with the appropriate type and range of devices that you want to connect to you connect to your master

    Resetting db state

    This is generally most useful when you want to get rid of all pending builds. First, add this to your master's Makefile:

     	rm master/state.sqlite
     	cd master && $(BUILDBOT) upgrade-master $$PWD

    Then run:

      make stop
      make reset-db
      make start

    Getting build notifications

    It might be useful to know when a build finishes or the status of certain builds. This way you don't have to keep an eye on your dev master and move on to other awesome things. There are a few ways to accomplish this:

    • Using Buildbot's IRC bot
      • add the following to your list of status obj in your master.cfg:
      from buildbot.status import words
      irc = words.IRC("", "<your-bot-nick>", 
                      channels=["<irc-channel>"],  useSSL=True,
                      port=6697, allowForce=False,
                        'exception': 1,
                        'successToFailure': 1,
                        'failureToSuccess': 1,
    • now reconfig and your should see your bot join <irc-channel>. From there you can do a number of things:
    • I like to start a private chat with my bot and request the build status when a job finishes. This gives me actual pings! You can do this like so from irc:
      > /query <your-bot-nick>
      > notify on finished
    • Using Check4Change Firefox extension:
      • this extension will check if a page changes without having to actually refresh! You can hook this up to your dev master buildbot web UI
      • for more details:

    See Also