Coder Social home page Coder Social logo

bors's Introduction

Bors is an automated integrator for github and buildbot.

It's written for the rust project, so probably contains a number of peculiarities of this project. You may need to do some work to reuse it elsewhere.

We assume bors is run in a loop, perhaps once per minute from cron (github has a rate-limited API). Each time it runs it reloads its entire state from github and buildbot, decides what the most fruitful next-thing it can do is, does that one thing, and exits. This is a crude design but it means the script and workspace is mostly stateless and should (once debugged) never require operator intervention in the workspace driving it, only sometimes on the sites it reads from (github and buildbot).

It requires a config file, bors.cfg, in its workspace. This config file should hold the a json dictionary:

 {
       "owner": "<github-username-the-owner-of-repo>",
       "repo": "<short-github-repo-name>",
       "reviewers": ["<user1>", "<user2>", ...],
       "builders": ["<buildbot-builder1>", "<buildbot-builder2>", ...],
       "test_ref": "<git-ref-for-testing>",
       "master_ref": "<git-ref-for-integration>",
       "nbuilds": <number-of-buildbot-builds-history-to-look-at>,
       "buildbot": "<buildbot-url>",
       "gh_user": "<github-user-to-run-as>",
       "gh_pass": "<password-for-that-user>"
 }

For example, the rust config at the time of writing (minus password) is:

 {
       "owner": "mozilla",
       "repo": "rust",
       "reviewers": ["brson", "catamorphism", "graydon", "nikomatsakis", "pcwalton"],
       "builders": ["auto-linux", "auto-win", "auto-bsd", "auto-mac"],
       "test_ref": "auto",
       "master_ref": "incoming",
       "nbuilds": 5,
       "buildbot": "http://buildbot.rust-lang.org",
       "gh_user": "bors",
       "gh_pass": "..."
 }

The general cycle of bors' operation is as follows:

  • load all pull reqs

  • load all statuses and comments

  • sort them by the STATE_* values below

  • pick the ripest (latest-state) one and try to advance it, meaning:

    • if state==UNREVIEWED or DISCUSSING, look for r+ or r-:

      • if r+, set APPROVED
      • if r-, set DISAPPROVED
      • (if nothing is said, exit; nothing to do!)
    • if state==APPROVED, merge pull.sha + master => test_ref:

      • if merge ok, set PENDING
      • if merge fail, set ERROR (pull req bitrotted)
    • if state==PENDING, look at buildbot for test results:

      • if failed, set FAILED
      • if passed, set TESTED
      • (if no test status, exit; waiting for results)
    • if state==TESTED, fast-forward master to test_ref

      • if ffwd works, close pull req
      • if ffwd fails, set ERROR (someone moved master on us)

License

Copyright 2013 Mozilla Foundation.

Licensed under the Apache License, Version 2.0 or the MIT license, at your option. These files may not be copied, modified, or distributed except according to those terms.

bors's People

Contributors

graydon avatar brson avatar reiddraper avatar vagabond avatar frewsxcv avatar bhearsum avatar nathantypanski avatar avoine avatar mortimerp9 avatar cblp avatar

Watchers

wfxiang08 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.