Skip to content
James Ketrenos edited this page Aug 5, 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

  • Install node and MongoDB
  • Check out codes from powerbuilder.sh.intel.com:/home/www-data/git-repos/github-worker.git
  • Configure the config file
  • Start /your/dir/to/mongoDB/bin/mongod by default setting
  • cp github-worker/src/run_trybot_github.sh to /your/dir/to/build-infrastructure/

Start

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

Codes

  • src/index.js Interface to start the WORKER.
  • 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.
  • lib/common.js Common settings and load config.
  • src/config The config file, see details in the template.
  • lib/command.js Interface to run the local command.
  • lib/github.js Interface to interact with the trybot.
  • lib/dashboard.js Interface to interact with the github comments.
  • lib/db.js Connect the mongoDB.
Clone this wiki locally