ReleaseEngineering/Applications/BuildbotBridge: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:


== Development ==
== Development ==
To do development of the Buildbot Bridge is it recommended that you run your own versions of each of its components. You will need a few other things before this will work:
When working on low or medium risk patches to the Buildbot Bridge it's easiest to write unit tests, get review, and then use the supported development environment for testing. For more major changes, it's better to set up your own instances of each component, pointed at your own Buildbot Master. Details on each of these is below:
 
=== Official Development Instance ===
Working with the official development evironment is just like working with production. It is managed by Puppet, and must be deployed through it. Once your new code is deployed to it (see below for how to do that), you can create Tasks for builders on the "alder" project branch and dev will pay attention to them.
 
=== DIY ===
You will need a few things to have a fully functioning Buildbot Bridge set-up:
* [https://tools.taskcluster.net/auth/ Taskcluster credentials]
* [https://tools.taskcluster.net/auth/ Taskcluster credentials]
* [[ReleaseEngineering/How_To/Setup_Personal_Development_Master A Build and/or Test Buildbot master]]
* [[ReleaseEngineering/How_To/Setup_Personal_Development_Master | A Build and/or Test Buildbot master]]
** You must be running command_runner.py and pulse_publisher.py as well.
** You must be running command_runner.py and pulse_publisher.py as well.
** If you need both, they must be pointed at the same database
** If you need both, they must be pointed at the same database
Line 29: Line 35:
     "buildbot_scheduler_db": "sqlite:////builds/buildbot/bhearsum/build1/master/state.sqlite",
     "buildbot_scheduler_db": "sqlite:////builds/buildbot/bhearsum/build1/master/state.sqlite",
     "bbb_db": "sqlite:///bbb.db",
     "bbb_db": "sqlite:///bbb.db",
    "selfserve_url": "http://foo.com/junk",


     "pulse_user": "bhearsum-publisher",
     "pulse_user": "bhearsum-publisher",
Line 34: Line 41:
     "pulse_queue_basename": "queue/bhearsum-publisher",
     "pulse_queue_basename": "queue/bhearsum-publisher",


     "allowed_builders": [
     "restricted_builders": [],
        ".*"
    "ignored_builders": [],
    ],


     "tclistener": {
     "tclistener": {
Line 42: Line 48:
         "worker_type": "buildbot-bridge-bhearsum",
         "worker_type": "buildbot-bridge-bhearsum",
         "provisioner_id": "buildbot-bridge-bhearsum",
         "provisioner_id": "buildbot-bridge-bhearsum",
        "selfserve_url": "http://foo.com/junk",
         "logfile": "tclistener.log"
         "logfile": "tclistener.log"
     },
     },
Line 61: Line 66:


== Deployment ==
== Deployment ==
The Buildbot Bridge services run on multiple machines for redundancy and increased throughput. The installations are fully deployed and managed by Puppet. The running services are managed by supervisord. You can find them in "/builds/bbb" on the following Buildbot masters:
The Buildbot Bridge services run on multiple machines for redundancy and increased throughput. The installations are fully deployed and managed by Puppet. The running services are managed by supervisord. You can find them in "/builds/bbb" on the following Buildbot masters.
* buildbot-master70.bb.releng.use1.mozilla.com
* Production:
* buildbot-master72.bb.releng.usw2.mozilla.com
** buildbot-master70.bb.releng.use1.mozilla.com
* buildbot-master82.bb.releng.scl3.mozilla.com
** buildbot-master72.bb.releng.usw2.mozilla.com
** buildbot-master82.bb.releng.scl3.mozilla.com
* Dev:
** buildbot-master84.bb.releng.scl3.mozilla.com


=== How to update ===
=== How to update ===
Line 71: Line 79:
# Run "python setup.py sdist" to generate a new tarball.
# Run "python setup.py sdist" to generate a new tarball.
# [[ReleaseEngineering/PuppetAgain/Data#.._add_a_data_file | Copy the tarball to the puppet server]]
# [[ReleaseEngineering/PuppetAgain/Data#.._add_a_data_file | Copy the tarball to the puppet server]]
# Update the [https://github.com/mozilla/build-puppet/blob/master/modules/buildbot_bridge/manifests/init.pp#L35 package list in the Buildbot Bridge puppet module]
# Update the dev or prod [https://github.com/mozilla/build-puppet/blob/master/manifests/moco-config.pp version in Puppet].
# Wait for Puppet to update the installations and restart the instances
# Wait for Puppet to update the installations and restart the instances



Revision as of 18:43, 14 September 2015

Buildbot Bridge (BBB)

The Buildbot Bridge is a set of services that allow us to schedule jobs in Taskcluster but run them in Buildbot. The Taskcluster Listener listens for pending Taskcluster Tasks and creates BuildRequests for them. The Buildbot Listener listens for Buildbot events for those jobs, and updates the Taskcluster Tasks accordingly. The Reflector reclaims Taskcluster Tasks and polls for changes that can't be detected by listening for Taskcluster on Buildbot events.

Interactions with other systems

The Bridge interacts with and has credentials for many different systems:

  • Taskcluster - To claim and resolve Tasks
  • Buildbot Scheduler DB - To create BuildRequests
  • Buildbot Bridge Database - To track ongoing jobs
  • Pulse - To subscribe to Taskcluster and Buildbot exchanges
  • Self Serve - To cancel Builds and BuildRequests

Development

When working on low or medium risk patches to the Buildbot Bridge it's easiest to write unit tests, get review, and then use the supported development environment for testing. For more major changes, it's better to set up your own instances of each component, pointed at your own Buildbot Master. Details on each of these is below:

Official Development Instance

Working with the official development evironment is just like working with production. It is managed by Puppet, and must be deployed through it. Once your new code is deployed to it (see below for how to do that), you can create Tasks for builders on the "alder" project branch and dev will pay attention to them.

DIY

You will need a few things to have a fully functioning Buildbot Bridge set-up:

Once you have those, adjust the config to use them as well as your own provisioner id, worker group, and worker id. For example, here is the config that bhearsum uses:

{
    "taskcluster_queue_config": {
        "credentials": {
            "clientId": "<redacted>",
            "accessToken": "<redacted>"
        }
    },
    "buildbot_scheduler_db": "sqlite:////builds/buildbot/bhearsum/build1/master/state.sqlite",
    "bbb_db": "sqlite:///bbb.db",
    "selfserve_url": "http://foo.com/junk",

    "pulse_user": "bhearsum-publisher",
    "pulse_password": "<redacted>",
    "pulse_queue_basename": "queue/bhearsum-publisher",

    "restricted_builders": [],
    "ignored_builders": [],

    "tclistener": {
        "pulse_exchange_basename": "exchange/taskcluster-queue/v1",
        "worker_type": "buildbot-bridge-bhearsum",
        "provisioner_id": "buildbot-bridge-bhearsum",
        "logfile": "tclistener.log"
    },
    "bblistener": {
        "pulse_exchange": "exchange/bhearsum-publisher/buildbot",
        "tc_worker_group": "buildbot-bridge-bhearsum",
        "tc_worker_id": "buildbot-bridge-bhearsum",
        "logfile": "bblistener.log"
    },
    "reflector": {
        "interval": 60,
        "logfile": "reflector.log"
    }
}

Note that the selfserve_url is junk. This is because there is no staging vesrion of BuildAPI (like most of the rest of our CI infrastructure), so you'll be unable to test changes that depend on it in dev unless you set-up your own instance.

Deployment

The Buildbot Bridge services run on multiple machines for redundancy and increased throughput. The installations are fully deployed and managed by Puppet. The running services are managed by supervisord. You can find them in "/builds/bbb" on the following Buildbot masters.

  • Production:
    • buildbot-master70.bb.releng.use1.mozilla.com
    • buildbot-master72.bb.releng.usw2.mozilla.com
    • buildbot-master82.bb.releng.scl3.mozilla.com
  • Dev:
    • buildbot-master84.bb.releng.scl3.mozilla.com

How to update

To deploy new Buildbot Bridge code you must generate a new Python package and have Puppet deploy it. Once your code has been reviewed and landed, do the following to deploy it:

  1. Bump the version in setup.py
  2. Run "python setup.py sdist" to generate a new tarball.
  3. Copy the tarball to the puppet server
  4. Update the dev or prod version in Puppet.
  5. Wait for Puppet to update the installations and restart the instances

How to restart the services

If you need to restart the Buildbot Bridge for any reason, you can do so by running the following as root (don't forget it runs on three different machines):

for i in bblistener tclistener reflector; do supervisorctl restart buildbot_bridge_$i; done

What to expect in /builds/bbb

root@buildbot-master70.bb.releng.use1.mozilla.com bbb]# ls -tlr
total 2756
drwxr-xr-x 3 cltbld cltbld    4096 May  5 08:18 lib
lrwxrwxrwx 1 cltbld cltbld      15 May  5 08:18 lib64 -> /builds/bbb/lib
drwxr-xr-x 2 cltbld cltbld    4096 May  5 08:18 include
-rw------- 1 cltbld cltbld    1241 May 21 05:41 config.json
drwxr-xr-x 2 cltbld cltbld    4096 May 25 07:07 bin
-rw-r--r-- 1 cltbld cltbld 2372446 May 25 10:55 reflector.log
-rw-r--r-- 1 cltbld cltbld  359635 May 25 11:48 bblistener.log
-rw-r--r-- 1 cltbld cltbld   56047 May 26 07:12 tclistener.log

As you can see, each service has its own log file. The supervisord logs sometimes have additional information in error cases, and can be found in /var/log/supervisord.