buildbot: 0.9.4 -> 0.9.5

- adds distro dependency
- buildbot nodaemon in service module
- fakerepo for module tests
- service module parameter fixup
- tested on nixos
- tested on darwin
This commit is contained in:
Fernando J Pando
2017-04-21 10:32:36 -04:00
parent 4c0098f1dc
commit 4ac06ea6a1
6 changed files with 141 additions and 64 deletions
@@ -12,7 +12,7 @@ let
factory = util.BuildFactory()
c = BuildmasterConfig = dict(
workers = [${concatStringsSep "," cfg.workers}],
protocols = { 'pb': {'port': ${cfg.bpPort} } },
protocols = { 'pb': {'port': ${toString cfg.bpPort} } },
title = '${escapeStr cfg.title}',
titleURL = '${escapeStr cfg.titleUrl}',
buildbotURL = '${escapeStr cfg.buildbotUrl}',
@@ -62,7 +62,7 @@ in {
extraConfig = mkOption {
type = types.str;
description = "Extra configuration to append to master.cfg";
default = "";
default = "c['buildbotNetUsageData'] = None";
};
masterCfg = mkOption {
@@ -92,10 +92,7 @@ in {
workers = mkOption {
type = types.listOf types.str;
description = "List of Workers.";
default = [
"worker.Worker('example-worker', 'pass')"
];
example = [ "worker.LocalWorker('example-worker')" ];
default = [ "worker.Worker('example-worker', 'pass')" ];
};
status = mkOption {
@@ -135,9 +132,8 @@ in {
};
bpPort = mkOption {
default = "9989";
type = types.string;
example = "tcp:10000:interface=127.0.0.1";
default = 9989;
type = types.int;
description = "Port where the master will listen to Buildbot Worker.";
};
@@ -179,14 +175,14 @@ in {
package = mkOption {
type = types.package;
default = pkgs.buildbot-ui;
defaultText = "pkgs.buildbot-ui";
default = pkgs.buildbot-full;
defaultText = "pkgs.buildbot-full";
description = "Package to use for buildbot.";
example = literalExample "pkgs.buildbot-full";
};
packages = mkOption {
default = [ ];
default = with pkgs; [ python27Packages.twisted git ];
example = literalExample "[ pkgs.git ]";
type = types.listOf types.package;
description = "Packages to add to PATH for the buildbot process.";
@@ -212,29 +208,30 @@ in {
systemd.services.buildbot-master = {
description = "Buildbot Continuous Integration Server.";
after = [ "network.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
path = cfg.packages;
preStart = ''
env > envvars
mkdir -vp ${cfg.buildbotDir}
ln -sfv ${masterCfg} ${cfg.buildbotDir}/master.cfg
rm -fv $cfg.buildbotDir}/buildbot.tac
${cfg.package}/bin/buildbot create-master ${cfg.buildbotDir}
'';
serviceConfig = {
Type = "simple";
User = cfg.user;
Group = cfg.group;
WorkingDirectory = cfg.home;
ExecStart = "${cfg.package}/bin/buildbot start --nodaemon ${cfg.buildbotDir}";
Environment = "PYTHONPATH=${cfg.package}/lib/python2.7/site-packages:${pkgs.buildbot-plugins.www}/lib/python2.7/site-packages:${pkgs.buildbot-plugins.waterfall-view}/lib/python2.7/site-packages:${pkgs.buildbot-plugins.console-view}/lib/python2.7/site-packages:${pkgs.python27Packages.future}/lib/python2.7/site-packages:${pkgs.python27Packages.dateutil}/lib/python2.7/site-packages:${pkgs.python27Packages.six}/lib/python2.7/site-packages:${pkgs.python27Packages.sqlalchemy}/lib/python2.7/site-packages:${pkgs.python27Packages.jinja2}/lib/python2.7/site-packages:${pkgs.python27Packages.markupsafe}/lib/python2.7/site-packages:${pkgs.python27Packages.sqlalchemy_migrate}/lib/python2.7/site-packages:${pkgs.python27Packages.tempita}/lib/python2.7/site-packages:${pkgs.python27Packages.decorator}/lib/python2.7/site-packages:${pkgs.python27Packages.sqlparse}/lib/python2.7/site-packages:${pkgs.python27Packages.txaio}/lib/python2.7/site-packages:${pkgs.python27Packages.autobahn}/lib/python2.7/site-packages:${pkgs.python27Packages.pyjwt}/lib/python2.7/site-packages:${pkgs.python27Packages.distro}/lib/python2.7/site-packages:${pkgs.python27Packages.pbr}/lib/python2.7/site-packages:${pkgs.python27Packages.urllib3}/lib/python2.7/site-packages";
# NOTE: call twistd directly with stdout logging for systemd
#ExecStart = "${cfg.package}/bin/buildbot start --nodaemon ${cfg.buildbotDir}";
ExecStart = "${pkgs.python27Packages.twisted}/bin/twistd -n -l - -y ${cfg.buildbotDir}/buildbot.tac";
};
preStart = ''
${pkgs.coreutils}/bin/mkdir -vp ${cfg.buildbotDir}
${pkgs.coreutils}/bin/ln -sfv ${masterCfg} ${cfg.buildbotDir}/master.cfg
${cfg.package}/bin/buildbot create-master ${cfg.buildbotDir}
'';
postStart = ''
until [[ $(${pkgs.curl}/bin/curl -s --head -w '\n%{http_code}' http://localhost:${toString cfg.port} | tail -n1) =~ ^(200|403)$ ]]; do
sleep 1
done
'';
};
};
@@ -74,7 +74,7 @@ in {
};
packages = mkOption {
default = [ ];
default = with pkgs; [ python27Packages.twisted git ];
example = literalExample "[ pkgs.git ]";
type = types.listOf types.package;
description = "Packages to add to PATH for the buildbot process.";
@@ -106,7 +106,8 @@ in {
path = cfg.packages;
preStart = ''
${pkgs.coreutils}/bin/mkdir -vp ${cfg.buildbotDir}
mkdir -vp ${cfg.buildbotDir}
rm -fv $cfg.buildbotDir}/buildbot.tac
${cfg.package}/bin/buildbot-worker create-worker ${cfg.buildbotDir} ${cfg.masterUrl} ${cfg.workerUser} ${cfg.workerPass}
'';
@@ -115,7 +116,11 @@ in {
User = cfg.user;
Group = cfg.group;
WorkingDirectory = cfg.home;
ExecStart = "${cfg.package}/bin/buildbot-worker start --nodaemon ${cfg.buildbotDir}";
Environment = "PYTHONPATH=${cfg.package}/lib/python2.7/site-packages:${pkgs.python27Packages.future}/lib/python2.7/site-packages";
# NOTE: call twistd directly with stdout logging for systemd
#ExecStart = "${cfg.package}/bin/buildbot-worker start --nodaemon ${cfg.buildbotDir}";
ExecStart = "${pkgs.python27Packages.twisted}/bin/twistd -n -l - -y ${cfg.buildbotDir}/buildbot.tac";
};
};