CI system for the distro
Find a file
Graham Christensen 4ae086fca8
Tag issues :)
2017-11-19 18:21:01 -05:00
doc Add a sample-command workflow 2017-11-06 12:38:23 -05:00
ofborg Tag issues :) 2017-11-19 18:21:01 -05:00
src Allow eventts for channels 2017-11-18 13:43:49 -05:00
web switch to a topical exchange 2017-10-31 04:09:06 -04:00
.gitignore It takes build jobs now? 2017-11-06 16:56:58 -05:00
build-filter.php build-filter: ensure attrs are a list, not an object... oy! 2017-11-09 07:32:19 -05:00
builder.php Add more details to the build job 2017-11-06 12:37:59 -05: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
config.example.json Builder works! 2017-11-10 20:01:52 -05:00
mass-rebuild-filter.php add label event, debugging for mass rebuild filtering 2017-11-12 14:46:31 -05:00
mass-rebuilder.php mass rebuilder: if we can't enumerate packages, don't count how many changed 2017-11-14 08:27:35 -05:00
poster.php Don't approve PRs 2017-11-17 19:31:59 -05:00
README.md update the reademe 2017-11-11 07:51:24 -05:00
service.nix borg service example 2017-11-04 12:24:18 -04:00
shell.nix Implement the build-filter 2017-11-14 08:32:28 -05: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.

Getting Started

  • you'll need to create the WORKING_DIR
  • nix-shell
  • composer install
  • php builder.php

The conspicuously missing config.php looks like:

<?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;
}

/*
# Only leader machines (ie: graham's) need this:
function gh_client() {
    $client = new \Github\Client();
    $client->authenticate('githubusername',
                          'githubpassword',
                          Github\Client::AUTH_HTTP_PASSWORD);

    return $client;
}
*/

Getting started on the rust one...

cargo build

then copy config.example.json to config.json and edit its vars. Set nix.remote to an empty string if you're not using the daemon.

Run

./target/debug/builder ./config.json