Skip to content
xingnan edited this page May 27, 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 pull requests                Pulling the status of trybot builds
GITHUB <======================================= WORDER ============================================> TRYBOT
 
  |      -----------Created/Updated----------->   |                                                    |
  |      <--------Update the dashboard---------   |                                                    |
  |      -------Trigger build by reviewer----->   |                                                    |
  |                                               |     ----------run_trybot_github.sh------------>    |
  |      <--------Update the dashboard---------   |                                                    |
  |                                               |                                                    |
  |                                               |     <------------Finished the build------------    |
  |      <--------Update the dashboard---------   |                                                    |
  |      -----------Trigger rebuild------------   |                                                    |
  |                                               |     ----------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. run_trybot_github.sh is a wrap script to run depot_tools/trychange.py to create the build in trybot.
  4. The dashboard in GITHUB repo actually is a comment sent by the WORKDER, which can be updated by reviewers and WORKER.
  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 in the github-worker/src/lib/common.js
  • Start /your/dir/to/mongoDB/bin/mongod by default setting
  • cp github-worker/src/run_trybot_github.sh to /your/dir/to/build-infrastructure/
  • Run node index.js in github-worker/src/

Codes

  • src/index.js Interface to start the WORDER.
  • 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 Configs in this file.
  • 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 mondoDB.

Introduction

Clone this wiki locally