summary refs log tree commit diff
path: root/nixos/modules/services/continuous-integration
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2017-05-03 07:56:29 +0200
committerGitHub <noreply@github.com>2017-05-03 07:56:29 +0200
commit9e48fc3268fcaf7a7cde724eaf38d246abad9b5d (patch)
tree4690af4b8b730a9b12a153ad968dad6ac01cb1d0 /nixos/modules/services/continuous-integration
parentc5a5ac1ef78badf35a0526829d4b8058448de94e (diff)
parent4ac06ea6a13bf082791f1e3293528dc6c1b67841 (diff)
downloadnixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar.gz
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar.bz2
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar.lz
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar.xz
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.tar.zst
nixlib-9e48fc3268fcaf7a7cde724eaf38d246abad9b5d.zip
Merge pull request #24131 from nand0p/buildbot-0.9.5
buildbot: 0.9.4 -> 0.9.5
Diffstat (limited to 'nixos/modules/services/continuous-integration')
-rw-r--r--nixos/modules/services/continuous-integration/buildbot/master.nix47
-rw-r--r--nixos/modules/services/continuous-integration/buildbot/worker.nix11
2 files changed, 30 insertions, 28 deletions
diff --git a/nixos/modules/services/continuous-integration/buildbot/master.nix b/nixos/modules/services/continuous-integration/buildbot/master.nix
index 533751734fa5..244aae445966 100644
--- a/nixos/modules/services/continuous-integration/buildbot/master.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/master.nix
@@ -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";
 
-      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}
-      '';
+        # 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";
+      };
 
-      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
-      '';
     };
   };
 
diff --git a/nixos/modules/services/continuous-integration/buildbot/worker.nix b/nixos/modules/services/continuous-integration/buildbot/worker.nix
index e4ee4dd861ef..a97f571e89df 100644
--- a/nixos/modules/services/continuous-integration/buildbot/worker.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/worker.nix
@@ -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";
       };
 
     };