Merge remote-tracking branch 'gum/master'

This commit is contained in:
lassulus 2015-12-20 19:00:20 +01:00
commit 85f3aa5b86
8 changed files with 101 additions and 58 deletions

View File

@ -4,9 +4,9 @@ stdenv.mkDerivation {
name = "cac-1.0.0"; name = "cac-1.0.0";
src = fetchgit { src = fetchgit {
url = http://cgit.cd.retiolum/cac; url = http://cgit.gum/cac;
rev = "14de1d3c78385e3f8b6d694f5d799eb1b613159e"; rev = "fe3b2ecb0aaf7d863842b896e18cd2b829f2297b";
sha256 = "9b2a3d47345d6f8f27d9764c4f2f2acff17d3dde145dd0e674e4183e9312fec3"; sha256 = "05bnd7wyjhqy8srmpnc8d234rv3jxdjgb4z0hlfb9kg7mb12w1ya";
}; };
phases = [ phases = [

View File

@ -35,6 +35,8 @@ in {
masterhost = "localhost"; masterhost = "localhost";
username = "testslave"; username = "testslave";
password = "krebspass"; password = "krebspass";
packages = with pkgs;[ git nix ];
extraEnviron = { NIX_PATH="nixpkgs=${toString <nixpkgs>}"; };
}; };
krebs.build.source.git.nixpkgs = { krebs.build.source.git.nixpkgs = {
@ -63,6 +65,7 @@ in {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
25 25
80 80
8010
]; ];
krebs.retiolum = { krebs.retiolum = {

View File

@ -59,16 +59,7 @@ let
set-owners repo all-makefu ++ set-ro-access repo krebsminister; set-owners repo all-makefu ++ set-ro-access repo krebsminister;
in { in {
imports = [{ imports = [ ];
krebs.users.makefu-omo = {
name = "makefu-omo" ;
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_omo.ssh.pub;
};
krebs.users.makefu-tsp = {
name = "makefu-tsp" ;
pubkey= with builtins; readFile ../../../krebs/Zpubkeys/makefu_tsp.ssh.pub;
};
}];
krebs.git = { krebs.git = {
enable = true; enable = true;
cgit = false; cgit = false;

View File

@ -6,6 +6,7 @@ let
buildbot-master-config = pkgs.writeText "buildbot-master.cfg" '' buildbot-master-config = pkgs.writeText "buildbot-master.cfg" ''
# -*- python -*- # -*- python -*-
from buildbot.plugins import * from buildbot.plugins import *
import re
c = BuildmasterConfig = {} c = BuildmasterConfig = {}
@ -25,40 +26,72 @@ let
stockholm_repo, stockholm_repo,
workdir='stockholm-poller', branch='master', workdir='stockholm-poller', branch='master',
project='stockholm', project='stockholm',
pollinterval=300)) pollinterval=120))
####### Build Scheduler ####### Build Scheduler
# TODO: configure scheduler # TODO: configure scheduler
important_files = util.ChangeFilter(
project_re="^((krebs|share)/.*|Makefile|default.nix)",
branch='master')
c['schedulers'] = [] c['schedulers'] = []
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="all-important-files", # test the master real quick
change_filter=important_files, fast = schedulers.SingleBranchScheduler(
# 3 minutes stable tree change_filter=util.ChangeFilter(branch="master"),
treeStableTimer=3*60, name="fast-master-test",
builderNames=["runtests"])) builderNames=["fast-tests"])
c['schedulers'].append(schedulers.ForceScheduler(
force = schedulers.ForceScheduler(
name="force", 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 ###### The actual build
factory = util.BuildFactory() # couple of fast steps:
factory.addStep(steps.Git(repourl=stockholm_repo, mode='incremental')) 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" ] deps = [ "gnumake", "jq" ]
factory.addStep(steps.ShellCommand(command=["nix-shell", "-p" ] + deps )) nixshell = ["nix-shell", "-p" ] + deps + [ "--run" ]
factory.addStep(steps.ShellCommand(env={"LOGNAME": "shared"}, def addShell(f,**kwargs):
command=["make", "get=krebs.deploy", f.addStep(steps.ShellCommand(**kwargs))
"system=test-centos7"]))
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'] = []
c['builders'].append( c['builders'].append(
util.BuilderConfig(name="runtests", util.BuilderConfig(name="fast-tests",
# TODO: only some slaves being used in builder?
slavenames=slavenames, slavenames=slavenames,
factory=factory)) factory=f))
# TODO slow build
c['builders'].append(
util.BuilderConfig(name="full-tests",
slavenames=slavenames,
factory=f))
####### Status of Builds ####### Status of Builds
c['status'] = [] c['status'] = []
@ -86,8 +119,8 @@ let
# TODO: multiple channels # TODO: multiple channels
channels=["${cfg.irc.channel}"], channels=["${cfg.irc.channel}"],
notify_events={ notify_events={
'success': 1, #'success': 1,
'failure': 1, #'failure': 1,
'exception': 1, 'exception': 1,
'successToFailure': 1, 'successToFailure': 1,
'failureToSuccess': 1, 'failureToSuccess': 1,
@ -99,7 +132,9 @@ let
c['title'] = "Stockholm" c['title'] = "Stockholm"
c['titleURL'] = "http://krebsco.de" 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 ####### DB URL
c['db'] = { c['db'] = {
@ -112,7 +147,6 @@ let
api = { api = {
enable = mkEnableOption "Buildbot Master"; enable = mkEnableOption "Buildbot Master";
workDir = mkOption { workDir = mkOption {
default = "/var/lib/buildbot/master"; default = "/var/lib/buildbot/master";
type = types.str; type = types.str;
@ -157,6 +191,7 @@ let
}; };
}); });
}; };
extraConfig = mkOption { extraConfig = mkOption {
default = ""; default = "";
type = types.lines; type = types.lines;
@ -183,8 +218,10 @@ let
description = "Buildbot Master"; description = "Buildbot Master";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = [ pkgs.git ];
serviceConfig = let serviceConfig = let
workdir="${lib.shell.escape cfg.workDir}"; workdir="${lib.shell.escape cfg.workDir}";
# TODO: check if git is the only dep
in { in {
PermissionsStartOnly = true; PermissionsStartOnly = true;
Type = "forking"; Type = "forking";

View File

@ -38,7 +38,7 @@ let
allow_shutdown=allow_shutdown) allow_shutdown=allow_shutdown)
s.setServiceParent(application) s.setServiceParent(application)
''; '';
default-packages = [ pkgs.git pkgs.bash ];
cfg = config.makefu.buildbot.slave; cfg = config.makefu.buildbot.slave;
api = { 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 { extraConfig = mkOption {
default = ""; default = "";
type = types.lines; type = types.lines;
@ -121,6 +141,12 @@ let
description = "Buildbot Slave for ${cfg.username}@${cfg.masterhost}"; description = "Buildbot Slave for ${cfg.username}@${cfg.masterhost}";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = default-packages ++ cfg.packages;
environment = {
NIX_REMOTE="daemon";
} // cfg.extraEnviron;
serviceConfig = let serviceConfig = let
workdir = "${lib.shell.escape cfg.workDir}"; workdir = "${lib.shell.escape cfg.workDir}";
contact = "${lib.shell.escape cfg.contact}"; contact = "${lib.shell.escape cfg.contact}";

View File

@ -3,6 +3,7 @@ _:
{ {
imports = [ imports = [
./buildbot/master.nix ./buildbot/master.nix
./buildbot/slave.nix
]; ];
} }

View File

@ -3,29 +3,13 @@
let let
inherit (lib) head; inherit (lib) head;
ip = "168.235.145.85";
gw = "168.235.145.1";
in { in {
imports = [ imports = [
../2configs/base.nix ../2configs/base.nix
../2configs/os-templates/CAC-CentOS-7-64bit.nix ../2configs/os-templates/CAC-CentOS-7-64bit.nix
{ ../2configs/os-templates/temp-networking.nix
networking.interfaces.enp2s1.ip4 = [
{
address = ip;
prefixLength = 24;
}
];
networking.defaultGateway = gw;
networking.nameservers = [
"8.8.8.8"
]; ];
}
{
sound.enable = false; sound.enable = false;
}
];
krebs.build.host = config.krebs.hosts.test-centos7; krebs.build.host = config.krebs.hosts.test-centos7;
} }

View File

@ -12,6 +12,7 @@ in
../2configs/shack-nix-cacher.nix ../2configs/shack-nix-cacher.nix
../2configs/shack-drivedroid.nix ../2configs/shack-drivedroid.nix
../2configs/cac-ci.nix ../2configs/cac-ci.nix
../2configs/graphite.nix
]; ];
# use your own binary cache, fallback use cache.nixos.org (which is used by # use your own binary cache, fallback use cache.nixos.org (which is used by
# apt-cacher-ng in first place) # apt-cacher-ng in first place)