summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/buildbot
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-12-20 19:00:20 +0100
committerlassulus <lass@aidsballs.de>2015-12-20 19:00:20 +0100
commit85f3aa5b86ab9fd4afb7e5adafc0e329ab618102 (patch)
treeb5a8f94d5af87eb24c0df3a85577ab9fe4542419 /makefu/3modules/buildbot
parent07f4510ad0bff0f9d72e5dcee279a30a0d5f8da3 (diff)
parent5821d8438578db623a3e248c52fefa424fad0b51 (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/3modules/buildbot')
-rw-r--r--makefu/3modules/buildbot/master.nix89
-rw-r--r--makefu/3modules/buildbot/slave.nix28
2 files changed, 90 insertions, 27 deletions
diff --git a/makefu/3modules/buildbot/master.nix b/makefu/3modules/buildbot/master.nix
index 5d340f899..58e2f8175 100644
--- a/makefu/3modules/buildbot/master.nix
+++ b/makefu/3modules/buildbot/master.nix
@@ -6,6 +6,7 @@ let
buildbot-master-config = pkgs.writeText "buildbot-master.cfg" ''
# -*- python -*-
from buildbot.plugins import *
+ import re
c = BuildmasterConfig = {}
@@ -25,40 +26,72 @@ let
stockholm_repo,
workdir='stockholm-poller', branch='master',
project='stockholm',
- pollinterval=300))
+ pollinterval=120))
####### Build Scheduler
# TODO: configure scheduler
- important_files = util.ChangeFilter(
- project_re="^((krebs|share)/.*|Makefile|default.nix)",
- branch='master')
c['schedulers'] = []
- c['schedulers'].append(schedulers.SingleBranchScheduler(
- name="all-important-files",
- change_filter=important_files,
- # 3 minutes stable tree
- treeStableTimer=3*60,
- builderNames=["runtests"]))
- c['schedulers'].append(schedulers.ForceScheduler(
+
+ # test the master real quick
+ fast = schedulers.SingleBranchScheduler(
+ change_filter=util.ChangeFilter(branch="master"),
+ name="fast-master-test",
+ builderNames=["fast-tests"])
+
+ force = schedulers.ForceScheduler(
name="force",
- builderNames=["runtests"]))
+ builderNames=["full-tests"])
+
+ # files everyone depends on or are part of the share branch
+ def shared_files(change):
+ r =re.compile("^((krebs|share)/.*|Makefile|default.nix)")
+ for file in change.files:
+ if r.match(file):
+ return True
+ return False
+
+ full = schedulers.SingleBranchScheduler(
+ change_filter=util.ChangeFilter(branch="master"),
+ fileIsImportant=shared_files,
+ name="full-master-test",
+ builderNames=["full-tests"])
+ c['schedulers'] = [ fast, force, full ]
###### The actual build
- factory = util.BuildFactory()
- factory.addStep(steps.Git(repourl=stockholm_repo, mode='incremental'))
+ # couple of fast steps:
+ f = util.BuildFactory()
+ ## fetch repo
+ grab_repo = steps.Git(repourl=stockholm_repo, mode='incremental')
+ f.addStep(grab_repo)
+ # the dependencies which are used by the test script
deps = [ "gnumake", "jq" ]
- factory.addStep(steps.ShellCommand(command=["nix-shell", "-p" ] + deps ))
- factory.addStep(steps.ShellCommand(env={"LOGNAME": "shared"},
- command=["make", "get=krebs.deploy",
- "system=test-centos7"]))
+ nixshell = ["nix-shell", "-p" ] + deps + [ "--run" ]
+ def addShell(f,**kwargs):
+ f.addStep(steps.ShellCommand(**kwargs))
+
+ addShell(f,name="centos7-eval",env={"LOGNAME": "shared",
+ "get" : "krebs.deploy",
+ "filter" : "json"
+ },
+ command=nixshell + ["make -s eval system=test-centos7"])
+
+ addShell(f,name="wolf-eval",env={"LOGNAME": "shared",
+ "get" : "krebs.deploy",
+ "filter" : "json"
+ },
+ command=nixshell + ["make -s eval system=wolf"])
- # TODO: different Builders?
c['builders'] = []
c['builders'].append(
- util.BuilderConfig(name="runtests",
- # TODO: only some slaves being used in builder?
+ util.BuilderConfig(name="fast-tests",
slavenames=slavenames,
- factory=factory))
+ factory=f))
+
+ # TODO slow build
+ c['builders'].append(
+ util.BuilderConfig(name="full-tests",
+ slavenames=slavenames,
+ factory=f))
####### Status of Builds
c['status'] = []
@@ -86,8 +119,8 @@ let
# TODO: multiple channels
channels=["${cfg.irc.channel}"],
notify_events={
- 'success': 1,
- 'failure': 1,
+ #'success': 1,
+ #'failure': 1,
'exception': 1,
'successToFailure': 1,
'failureToSuccess': 1,
@@ -99,7 +132,9 @@ let
c['title'] = "Stockholm"
c['titleURL'] = "http://krebsco.de"
- c['buildbotURL'] = "http://buildbot.krebsco.de/"
+ #c['buildbotURL'] = "http://buildbot.krebsco.de/"
+ # TODO: configure url
+ c['buildbotURL'] = "http://vbob:8010/"
####### DB URL
c['db'] = {
@@ -112,7 +147,6 @@ let
api = {
enable = mkEnableOption "Buildbot Master";
-
workDir = mkOption {
default = "/var/lib/buildbot/master";
type = types.str;
@@ -157,6 +191,7 @@ let
};
});
};
+
extraConfig = mkOption {
default = "";
type = types.lines;
@@ -183,8 +218,10 @@ let
description = "Buildbot Master";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.git ];
serviceConfig = let
workdir="${lib.shell.escape cfg.workDir}";
+ # TODO: check if git is the only dep
in {
PermissionsStartOnly = true;
Type = "forking";
diff --git a/makefu/3modules/buildbot/slave.nix b/makefu/3modules/buildbot/slave.nix
index 188a9283c..69d0361bf 100644
--- a/makefu/3modules/buildbot/slave.nix
+++ b/makefu/3modules/buildbot/slave.nix
@@ -38,7 +38,7 @@ let
allow_shutdown=allow_shutdown)
s.setServiceParent(application)
'';
-
+ default-packages = [ pkgs.git pkgs.bash ];
cfg = config.makefu.buildbot.slave;
api = {
@@ -91,6 +91,26 @@ let
'';
};
+ packages = mkOption {
+ default = [ pkgs.git ];
+ type = with types; listOf package;
+ description = ''
+ packages which should be in path for buildslave
+ '';
+ };
+
+ extraEnviron = mkOption {
+ default = {};
+ example = {
+ NIX_PATH = "nixpkgs=/path/to/my/nixpkgs";
+ };
+ type = types.attrsOf types.str;
+ description = ''
+ extra environment variables to be provided to the buildslave service
+ if you need nixpkgs, e.g. for running nix-shell you can set NIX_PATH here.
+ '';
+ };
+
extraConfig = mkOption {
default = "";
type = types.lines;
@@ -121,6 +141,12 @@ let
description = "Buildbot Slave for ${cfg.username}@${cfg.masterhost}";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
+ path = default-packages ++ cfg.packages;
+
+ environment = {
+ NIX_REMOTE="daemon";
+ } // cfg.extraEnviron;
+
serviceConfig = let
workdir = "${lib.shell.escape cfg.workDir}";
contact = "${lib.shell.escape cfg.contact}";