diff options
-rw-r--r-- | krebs/5pkgs/cac/default.nix | 6 | ||||
-rw-r--r-- | makefu/1systems/vbob.nix | 3 | ||||
-rw-r--r-- | makefu/2configs/git/brain-retiolum.nix | 11 | ||||
-rw-r--r-- | makefu/3modules/buildbot/master.nix | 89 | ||||
-rw-r--r-- | makefu/3modules/buildbot/slave.nix | 28 | ||||
-rw-r--r-- | makefu/3modules/default.nix | 1 | ||||
-rw-r--r-- | shared/1systems/test-centos7.nix | 20 | ||||
-rw-r--r-- | shared/1systems/wolf.nix | 1 |
8 files changed, 101 insertions, 58 deletions
diff --git a/krebs/5pkgs/cac/default.nix b/krebs/5pkgs/cac/default.nix index e29f091e4..40dd56412 100644 --- a/krebs/5pkgs/cac/default.nix +++ b/krebs/5pkgs/cac/default.nix @@ -4,9 +4,9 @@ stdenv.mkDerivation { name = "cac-1.0.0"; src = fetchgit { - url = http://cgit.cd.retiolum/cac; - rev = "14de1d3c78385e3f8b6d694f5d799eb1b613159e"; - sha256 = "9b2a3d47345d6f8f27d9764c4f2f2acff17d3dde145dd0e674e4183e9312fec3"; + url = http://cgit.gum/cac; + rev = "fe3b2ecb0aaf7d863842b896e18cd2b829f2297b"; + sha256 = "05bnd7wyjhqy8srmpnc8d234rv3jxdjgb4z0hlfb9kg7mb12w1ya"; }; phases = [ diff --git a/makefu/1systems/vbob.nix b/makefu/1systems/vbob.nix index 5b03d40a8..a24cefd0d 100644 --- a/makefu/1systems/vbob.nix +++ b/makefu/1systems/vbob.nix @@ -35,6 +35,8 @@ in { masterhost = "localhost"; username = "testslave"; password = "krebspass"; + packages = with pkgs;[ git nix ]; + extraEnviron = { NIX_PATH="nixpkgs=${toString <nixpkgs>}"; }; }; krebs.build.source.git.nixpkgs = { @@ -63,6 +65,7 @@ in { networking.firewall.allowedTCPPorts = [ 25 80 + 8010 ]; krebs.retiolum = { diff --git a/makefu/2configs/git/brain-retiolum.nix b/makefu/2configs/git/brain-retiolum.nix index 066d50a28..25ef584bf 100644 --- a/makefu/2configs/git/brain-retiolum.nix +++ b/makefu/2configs/git/brain-retiolum.nix @@ -59,16 +59,7 @@ let set-owners repo all-makefu ++ set-ro-access repo krebsminister; in { - 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; - }; - }]; + imports = [ ]; krebs.git = { enable = true; cgit = false; 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}"; diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix index 4b2b36e64..ffbf54cc0 100644 --- a/makefu/3modules/default.nix +++ b/makefu/3modules/default.nix @@ -3,6 +3,7 @@ _: { imports = [ ./buildbot/master.nix + ./buildbot/slave.nix ]; } diff --git a/shared/1systems/test-centos7.nix b/shared/1systems/test-centos7.nix index 51e99600c..077a5d61b 100644 --- a/shared/1systems/test-centos7.nix +++ b/shared/1systems/test-centos7.nix @@ -3,29 +3,13 @@ let inherit (lib) head; - ip = "168.235.145.85"; - gw = "168.235.145.1"; in { imports = [ ../2configs/base.nix ../2configs/os-templates/CAC-CentOS-7-64bit.nix - { - networking.interfaces.enp2s1.ip4 = [ - { - address = ip; - prefixLength = 24; - } - ]; - networking.defaultGateway = gw; - networking.nameservers = [ - "8.8.8.8" - ]; - - } - { - sound.enable = false; - } + ../2configs/os-templates/temp-networking.nix ]; + sound.enable = false; krebs.build.host = config.krebs.hosts.test-centos7; } diff --git a/shared/1systems/wolf.nix b/shared/1systems/wolf.nix index a3e527a3b..2c51ac8fe 100644 --- a/shared/1systems/wolf.nix +++ b/shared/1systems/wolf.nix @@ -12,6 +12,7 @@ in ../2configs/shack-nix-cacher.nix ../2configs/shack-drivedroid.nix ../2configs/cac-ci.nix + ../2configs/graphite.nix ]; # use your own binary cache, fallback use cache.nixos.org (which is used by # apt-cacher-ng in first place) |