From 4d9c6dbbe22905a941e5039a6b27f80f6edb7648 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 2 Jul 2020 20:27:02 +0100 Subject: feat(whitby): Run a handful of Buildkite agents This is the point of the machine, afterall. Change-Id: I15c11600c1c18fa8962d57f75f99a72e1553f9c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/853 Reviewed-by: glittershark Reviewed-by: BuildkiteCI Tested-by: BuildkiteCI --- ops/nixos/whitby/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ops/nixos/whitby/default.nix b/ops/nixos/whitby/default.nix index d7f60a4d10..9b663fc8ef 100644 --- a/ops/nixos/whitby/default.nix +++ b/ops/nixos/whitby/default.nix @@ -1,8 +1,18 @@ { depot, lib, ... }: let + inherit (builtins) listToAttrs; + inherit (lib) range; + nixpkgs = import depot.third_party.nixpkgsSrc {}; + # All Buildkite hooks are actually besadii, but it's being invoked + # with different names. + buildkiteHooks = depot.third_party.runCommandNoCC "buildkite-hooks" {} '' + mkdir -p $out/bin + ln -s ${depot.ops.besadii}/bin/besadii $out/bin/post-command + ''; + systemForConfig = configuration: (depot.third_party.nixos { inherit configuration; }).system; @@ -119,6 +129,17 @@ in systemForConfig { programs.mtr.enable = true; services.openssh.enable = true; + # Run a handful of Buildkite agents to support parallel builds. + services.buildkite-agents = listToAttrs (map (n: rec { + name = "whitby-${toString n}"; + value = { + inherit name; + enable = true; + tokenPath = "/etc/secrets/buildkite-agent-token"; + hooks.post-command = "${buildkiteHooks}/bin/post-command"; + }; + }) (range 1 8)); + environment.systemPackages = with nixpkgs; [ bb curl -- cgit 1.4.1