From 136d7c2f41815eaa51221bfd13c7ff514a39ed73 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 8 Sep 2018 21:26:03 +0200 Subject: konsens: handle >2 commits --- krebs/3modules/konsens.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/konsens.nix b/krebs/3modules/konsens.nix index 47316d5d6..74895a971 100644 --- a/krebs/3modules/konsens.nix +++ b/krebs/3modules/konsens.nix @@ -68,7 +68,7 @@ let fi cd ${name} git fetch origin - git push origin $(git merge-base ${concatMapStringsSep " " (branch: "origin/${branch}") repo.branchesToCheck}):refs/heads/master + git push origin $(git merge-base --octopus ${concatMapStringsSep " " (branch: "origin/${branch}") repo.branchesToCheck}):refs/heads/master ''; WorkingDirectory = /var/lib/konsens; User = "konsens"; -- cgit v1.2.3 From 1fde1cf78a337d305c9d696cb3d12589fd26ccb3 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 9 Sep 2018 10:54:08 +0200 Subject: mv: RIP --- krebs/3modules/default.nix | 1 - krebs/3modules/mv/default.nix | 40 ---------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 krebs/3modules/mv/default.nix (limited to 'krebs/3modules') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 833349769..6328fe8f1 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -109,7 +109,6 @@ let { krebs = import ./krebs { inherit config; }; } { krebs = import ./lass { inherit config; }; } { krebs = import ./makefu { inherit config; }; } - { krebs = import ./mv { inherit config; }; } { krebs = import ./nin { inherit config; }; } { krebs = import ./tv { inherit config; }; } { diff --git a/krebs/3modules/mv/default.nix b/krebs/3modules/mv/default.nix deleted file mode 100644 index c8d138a44..000000000 --- a/krebs/3modules/mv/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, ... }: - -with import ; - -{ - hosts = mapAttrs (_: setAttr "owner" config.krebs.users.mv) { - stro = { - ci = true; - cores = 4; - nets = { - retiolum = { - ip4.addr = "10.243.111.111"; - ip6.addr = "42:0:0:0:0:0:111:111"; - aliases = [ - "stro.r" - "cgit.stro.r" - ]; - tinc.pubkey = '' - -----BEGIN RSA PUBLIC KEY----- - MIIBCgKCAQEA0vIzLyoetOyi3R7qOh3gjSvUVjPEdqCvd0NEevDCIhhFy0nIbZ/b - vnuk3EUeTb6e384J8fKB4agig0JeR3JjtDvtjy5g9Cdy2nrU71w8wqU0etmv2PTb - FjbCFfeBXn0N3U7gXwjZGCvjAXa1a4jGb4R2iYBYGG3aY4reCN8B8Ah81h+S0oLg - ZJJfaBmWM5vNRFEI5X4CLaVnwtsoZuXIjYStgNn/9Mg/Y6NQS0H0H+HFeyhigAqG - oYGqNar/2QqPU176V/FwrD30F3qJV1uyzuPta7hmdfOxqYjZ/jqdPSRYtlunYYcq - XbH5oYmzO9NEeVWzjdac/DiV2OP8HufoYwIDAQAB - -----END RSA PUBLIC KEY----- - ''; - }; - }; - ssh.privkey.path = ; - ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM+7Qa51l0NSkBiaK2s8vQEoeObV3UPZyEzMxfUK/ZAO root@stro"; - }; - }; - users = { - mv = { - mail = "mv@stro.r"; - pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDfMqkfXsGRaXJ86Pi5svAx4508ij5kc4cMLGwr1CLvFI5G7EHggiHMZYooibmkZimBF1PvLM1lOdoptJ4nSmc3UGuQaeV9BpZ1dNXexc8wOmVPKzAHYZG/2upcV/xVZQ9lk3UOmDym6fDUXThMx4nXdhOjScgWpKp7+0N3JRCf2UHusZjWFGlhE9l4irLFHCwlZeBQ16DNF4fc03vsfZBB1ZrGGZlaVpkcY+FTC3sm8R0iF5QGaq8PgltJoCNnp3L1g3Yn7Elva7kCHjZfJC1pu5icV8vZMNptPn1b10gPsNwb302FCjvZohzRcMo39L2gwdNWQmflYfYk+NPY9EgqkLtSvZJywYu8oTVLeYBAp0ZGzJR4+uIH9at/WQF499HFMxpF4uwYiQweUcPiHrrOqI5zLQoOvqh9Jv0UMsnFynNrszbCTgwzeW8bcvv8ILcjE9of8GXRCrlIMvt7Z9q8xrb5j1RhKscvusyyNOAL+HMZl6jgSxUBDtzRqPZ62QHJsBEBdRXdJRQLGeHNW9kGPrh/tiKGucuT3/HZC+2Rcemxt3RVT60+lHkghrMLi0/VOWBUKL9J94UK5xIE4Gb3RTW9DcNK53U4ql+N4ORSSEuhk3Rqzx3Bzv7AXpLKQCFKdB7tjxzGN7sCQM3PBUUo6Tk0VG2cIKOjzTRnDJlb7Q== mv@stro"; - }; - }; -} -- cgit v1.2.3 From 9bd3dd54c3a119aa1e900e43c08f5d79b1a7dcfc Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 9 Sep 2018 20:01:51 +0200 Subject: add ci module --- krebs/3modules/ci.nix | 162 +++++++++++++++++++++++++++++++++++++++++++++ krebs/3modules/default.nix | 1 + 2 files changed, 163 insertions(+) create mode 100644 krebs/3modules/ci.nix (limited to 'krebs/3modules') diff --git a/krebs/3modules/ci.nix b/krebs/3modules/ci.nix new file mode 100644 index 000000000..cf82401d3 --- /dev/null +++ b/krebs/3modules/ci.nix @@ -0,0 +1,162 @@ +{ config, lib, pkgs, ... }: + +with import ; + +let + cfg = config.krebs.ci; + + out = { + options.krebs.ci = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "Enable krebs ci service"; + repos = mkOption { + type = types.attrsOf (types.submodule ({ config, ...}: { + options = { + urls = mkOption { + type = types.listOf types.str; + default = [ "git@localhost:${config._module.args.name}" ]; + }; + }; + })); + }; + }; + + hostname = config.networking.hostName; + getJobs = pkgs.writeDash "get_jobs" '' + nix-build --no-out-link ./ci.nix 2>&1 > /dev/null + nix-instantiate --eval --strict --json ./ci.nix + ''; + + imp = { + krebs.buildbot.master = { + slaves = { + testslave = "lasspass"; + }; + + change_source = mapAttrs' (name: repo: + nameValuePair name (concatMapStrings (url: '' + cs.append( + changes.GitPoller( + "${url}", + workdir='${name}-${elemAt(splitString "." url) 1}', branches=True, + project='${name}', + pollinterval=10 + ) + ) + '') repo.urls) + ) cfg.repos; + + scheduler = mapAttrs' (name: repo: + nameValuePair name '' + sched.append( + schedulers.SingleBranchScheduler( + change_filter=util.ChangeFilter(branch_re=".*"), + treeStableTimer=60, + name="build-all-branches", + builderNames=[ + "${name}", + ] + ) + ) + sched.append( + schedulers.ForceScheduler( + name="${name}", + builderNames=[ + "${name}", + ] + ) + ) + '' + ) cfg.repos; + builder_pre = '' + from buildbot import interfaces + from buildbot.steps.shell import ShellCommand + + class StepToStartMoreSteps(ShellCommand): + def __init__(self, **kwargs): + ShellCommand.__init__(self, **kwargs) + + def addBuildSteps(self, steps_factories): + for sf in steps_factories: + step = interfaces.IBuildStepFactory(sf).buildStep() + step.setBuild(self.build) + step.setBuildSlave(self.build.slavebuilder.slave) + step_status = self.build.build_status.addStepWithName(step.name) + step.setStepStatus(step_status) + self.build.steps.append(step) + + def start(self): + props = self.build.getProperties() + new_steps = json.loads(props.getProperty('steps_json')) + for new_step in new_steps: + self.addBuildSteps([steps.ShellCommand( + name=str(new_step), + command=[ + new_steps[new_step] + ], + timeout=90001, + workdir='build', # TODO figure out why we need this? + )]) + + ShellCommand.start(self) + + ''; + + builder = mapAttrs' (name: repo: + nameValuePair name '' + f_${name} = util.BuildFactory() + f_${name}.addStep(steps.Git( + repourl=util.Property('repository', '${head repo.urls}'), + mode='full', + submodules=True, + )) + + f_${name}.addStep(steps.SetPropertyFromCommand( + env={ + "NIX_REMOTE": "daemon", + "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src", + }, + name="get_steps", + command=["${getJobs}"], + property="steps_json" + )) + f_${name}.addStep(StepToStartMoreSteps(command=["echo"])) # TODO remove dummy command from here + + bu.append( + util.BuilderConfig( + name="${name}", + slavenames=slavenames, + factory=f_${name} + ) + ) + '' + ) cfg.repos; + + enable = true; + web.enable = true; + irc = { + enable = true; + nick = "build|${hostname}"; + server = "irc.r"; + channels = [ "noise" ]; + allowForce = true; + }; + extraConfig = '' + c['buildbotURL'] = "http://build.${hostname}.r/" + ''; + }; + + krebs.buildbot.slave = { + enable = true; + masterhost = "localhost"; + username = "testslave"; + password = "lasspass"; + packages = with pkgs; [ gnumake jq nix populate gnutar lzma gzip ]; + }; + }; + +in out + diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 6328fe8f1..82ae3b02e 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -13,6 +13,7 @@ let ./buildbot/master.nix ./buildbot/slave.nix ./build.nix + ./ci.nix ./current.nix ./exim.nix ./exim-retiolum.nix -- cgit v1.2.3