Skip to content
forked from graydon/bors

Integration robot for buildbot and github

Notifications You must be signed in to change notification settings

sanitizers/bors

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Integration robot for buildbot and github

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.7%
  • JavaScript 11.2%
  • CSS 2.2%
  • HTML 0.9%