CI system for the distro
Find a file
2017-11-04 11:58:37 -04:00
src Use CommitStatus to make updating statuses cleaner 2017-11-04 11:58:37 -04:00
web switch to a topical exchange 2017-10-31 04:09:06 -04:00
.gitignore Initial port from my network 2017-10-29 17:10:26 -04:00
build-filter.php split mass-rebuild and mass-rebuild-filter 2017-10-31 04:09:41 -04:00
builder.php build with no out link for better GC 2017-11-04 11:56:57 -04:00
composer.json Initial port from my network 2017-10-29 17:10:26 -04:00
composer.lock Initial port from my network 2017-10-29 17:10:26 -04:00
mass-rebuild-filter.php :) 2017-11-03 08:34:18 -04:00
mass-rebuilder.php Use CommitStatus to make updating statuses cleaner 2017-11-04 11:58:37 -04:00
poster.php poster: send a Comment in place of an Approve if the PR is closed already 2017-11-04 11:58:04 -04:00
README.md catch proper ExecExceptions 2017-10-29 17:42:23 -04:00
shell.nix Initial port from my network 2017-10-29 17:10:26 -04:00

grahamcofborg

  1. All github events go in to web/index.php, which sends the event to an exchange named for the full name of the repo (ex: nixos/nixpkgs) in lower case. The exchange is set to "fanout"
  2. build-filter.php creates a queue called build-inputs and binds it to the nixos/nixpkgs exchange. It also creates an exchange, build-jobs, set to fan out. It listens for messages on the build-inputs queue. Issue comments from authorized users on PRs get tokenized and turned in to build instructions. These jobs are then written to the build-jobs exchange.
  3. builder.php creates a queue called build-inputs-x86_64-linux, and binds it to the build-jobs exchange. It then listens for build instructions on the build-inputs-x86_64-linux queue. For each job, it uses nix-build to run the build instructions. The status result (pass/fail) and the last ten lines of output are then placed in to the build-results queue.
  4. poster.php declares the build-results queue, and listens for messages on it. It posts the build status and text output on the PR the build is from.

The conspicuously missing config.php looks like:

(you'll need to create the WORKING_DIR)

<?php

require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPSSLConnection;
use PhpAmqpLib\Message\AMQPMessage;

define("NIX_SYSTEM", "x86_64-linux");
define("WORKING_DIR", "/home/grahamc/.nix-test");

function rabbitmq_conn() {
    $connection = new AMQPSSLConnection(
        'events.nix.gsc.io', 5671,
        eventsuser, eventspasswordd, '/', array(
            'verify_peer' => true,
            'verify_peer_name' => true,
            'peer_name' => 'events.nix.gsc.io',
            'verify_depth' => 10,
            'ca_file' => '/etc/ssl/certs/ca-certificates.crt'
        )
    );

    return $connection;
}

function gh_client() {
    $client = new \Github\Client();
    $client->authenticate('githubusername',
                          'githubpassword',
                          Github\Client::AUTH_HTTP_PASSWORD);

    return $client;


}