Personal tools

ReleaseEngineering/How To/Setup Personal Development Master

From MozillaWiki

Jump to: navigation, search

Contents

Setup

Prerequisites

  • python 2.6
  • virtualenv
    • If you need to create a virtualenv manually, you must call it directly with:
      python /tools/misc-python/virtualenv.py </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-master01 and a buildbot area under /builds/buildbot/your_name.
Ask someone with root access to set it up following instructions in here.
If you are setting dev-master01 you probably want to use root to set up an account in /builds/buildbot/your_name since 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

General

  • Instructions specific to dev-master01 (dev-master01.build.mozilla.org)
 # as root
 WHO=coop
 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".
      • /usr/bin/python2.6 setup-master.py -l -- display a list of enabled masters
      • /usr/bin/python2.6 setup-master.py -l -8 -- display a hardcoded list of 0.8.0 masters
    • PYTHON, HG, VIRTUALENV should be adjusted to your local environment

Create a build master

Use this automation script to create a build master, or follow the manual steps below.

First, clone the buildbot-configs repository.

$ hg clone http://hg.mozilla.org/build/buildbot-configs

Add 'try' to the list of ACTIVE_BRANCHES in master/master_localconfig.py.


create_master.sh

USERNAME=`whoami`
make -f Makefile.setup \
USE_DEV_MASTER=1 \
MASTER_NAME=$USERNAME \
BASEDIR=/builds/buildbot/$USERNAME/build1 \
PYTHON=python2.6 \
VIRTUALENV=virtualenv-2.6 \
BUILDBOTCUSTOM_BRANCH=default \
BUILDBOTCONFIGS_BRANCH=default \
USER=$USERNAME \
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/build_localconfig.py 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 passwords.py and require real secrets (meaning, do not distribute them publicly). The templatized version of passwords.py 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/builds/master/passwords.py on dev-master01. 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 passwords.py file from a production build master. If you have trouble with this, ask for help.

Create a tests master

Use this automation script (recommended) to create a build master, or use the same approach as for build master.

perl create-staging-master.pl -u coop --master-kind=test --master-dir=tests-master --http-port=8045

Customize your configs

  • In master/master_config.json, adjust ports for slavePortnum, webstatus & manhole
    • 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 slavePortnum, use 8099 for your webstatus and 1299 for your manhole.
  • 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:

 WHO=coop
 mkdir -p /dev/shm/${WHO}/queue
 chown ${WHO} /dev/shm/${WHO}
  • modify your master/master_localconfig.py 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"
   

Does it work?

  • If you want production schedulers to run, then "cd $BASEDIR/master; ln -sf ../buildbot-configs/mozilla/universal_master_sqlite.cfg master.cfg; cd -" (build master) or "cd $BASEDIR/master; ln -sf ../buildbot-configs/mozilla-tests/universal_master_sqlite.cfg master.cfg; cd -" (tests master). 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.

Sendchanges to your tests master from your build master

  • If you're running *both* a build master and a tests master and want to test the sendchanges between them, you should have a similar local change on your build master (replace 9041 with the relevant port on your tests master):
diff --git a/mozilla/staging_config.py b/mozilla/staging_config.py
--- a/mozilla/staging_config.py
+++ b/mozilla/staging_config.py
@@ -49,3 +49,3 @@ GLOBAL_VARS = {
     'talos_masters': [
-        ('dev-master01.build.mozilla.org:9009', True, 1),
+        ('staging-master:9041', True, 1),
     ],
@@ -55,4 +55,3 @@ GLOBAL_VARS = {
     'unittest_masters': [
-        ('staging-master.build.mozilla.org:9009', True, 1),
-        ('talos-staging-master02.build.mozilla.org:9012', True, 1),
+        ('dev-master01:9041', True, 1),
         ],

Adding your master to slavealloc

  • you will need to find out the host, password, and username for the slavealloc mysql url. If you don't know where our private things live, ask someone in releng.
# you will want to create a CSV similar to this one
# (where row 1 is column names and every subsequent row is your master you wish to add)
nickname,fqdn,http_port,pb_port,datacenter,pool
sm-armenzg-build,dev-master1.srv.releng.scl3.mozilla.com,8040,9040,scl3,staging-pers
sm-armenzg-test,dev-master1.srv.releng.scl3.mozilla.com,8041,9041,scl1,staging-pers

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. ./fresh_bb_setup Buildbot
  3. cd Buildbot; source bin/activate
  4. cd buildbot-configs; ./test-masters.sh
  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/master_localconfig.py
  • 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 127.0.0.1:{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 127.0.0.1:<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 (http://slavealloc.build.mozilla.org/ui/#slaves), 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.

    Optimizations

    master_localconfig.py

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

    master_config.json

    • 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": [
         "android",
         "android-armv6",
         "android-noion"
      ],
      "limit_tb_platforms": [],
      "limit_b2g_platforms": [],
    

    BuildSlaves.py

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

    staging_config.py

    • 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:

    reset-db:
    	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
      • first add the following to your list of status obj in your master.cfg:
     irc = words.IRC("irc.mozilla.org", "<your-bot-nick>", 
                     channels=["<irc-channel>"],  useSSL=True,
                     port=6697, allowForce=False,
                     notify_events={
                       'exception': 1,
                       'successToFailure': 1,
                       'failureToSuccess': 1,
                     })
     c['status'].append(irc)
    

    now reconfig and your should see your bot join <irc-channel>. From there you can do a number of things: http://docs.buildbot.net/0.8.0/IRC-Bot.html

    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: http://www.check4change.com/

    See Also