Skip to content
Trybot edited this page Aug 19, 2013 · 7 revisions

[Github Worker]

Introduction

Github Worker is a standalone server to help sync the github repos and trybot server. You can easily trigger, check and rebuild the patches of the github repos by comments in trybot.

Structure and Design

        Pulling the status of           Pulling the status of
             pull requests                   trybot builds
GITHUB <======================== WORKER =====================> TRYBOT
  | ------Created/Updated--------> |                             |
  |                                | ------Auto trigger -------> |
  | <---Update the dashboard------ |                             |
  |                                | --run_trybot_github.sh----> |
  | <---Update the dashboard------ |                             |
  |                                | <---Finished the build----- |
  | <----Update the dashboard----- |                             |
  | -Trigger rebuild by reviewers- |                             |
  |                                | ---run_trybot_github.sh---> |
  1. WORKER monitors the status of pull requests in GITHUB repos by Github API
  2. WORKER monitors the status of TRYBOT by the JSON API provided by http://wrt-buildbot.bj.intel.com/buildbot/json/help
  3. The dashboard in GITHUB repo actually is a comment sent by the WORKER, which can be updated by reviewers and WORKER.
  4. run_trybot_github.sh is a wrap script to run depot_tools/trychange.py to create the build in trybot.
  5. Reviewers can select the bots they want to try.
  6. Reviewers can select the bots to rebuild the patches.

Setup

Start

  • Start /your/dir/to/mongoDB/bin/mongod if it is not running
  • Run run.sh in github-worker/src/

Codes

  • src/config The config file, see details in the template.
  • src/index.js Interface to start the WORKER.
  • src/lib/daemon.js Main implementation of WORKER. Main loop in the file, call github API to fetch the events/status of pull requests; Handle the state machine of pull requests; etc.
  • src/lib/common.js Common settings and load config.
  • src/lib/command.js Interface to run the local command.
  • src/lib/trybot.js Interface to interact with the trybot.
  • src/lib/dashboard.js Interface to interact with the github comments.
  • src/lib/db.js Connect the mongoDB.
  • src/node_modules/ The nodejs modules used in this project.
Clone this wiki locally