about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-09 13:39:18 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-09 13:40:30 -0700
commit6acf96c42e2836b3ed77b8f269a1b3385910ce30 (patch)
tree02165f28886b141f66e99dd5e326326684c3cbf1
parentfeat(gerrit): update CL when buildKite build is finished (diff)
downloadworld-6acf96c42e2836b3ed77b8f269a1b3385910ce30.tar.gz
feat(buildkite): configure the post-command hook
Change-Id: I7b00987382ef05e032d88cf00e916cdc27511eb1
Reviewed-on: https://cl.fcuny.net/c/world/+/306
Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to '')
-rw-r--r--modules/services/buildkite/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/services/buildkite/default.nix b/modules/services/buildkite/default.nix
index a1bd021..72d5e08 100644
--- a/modules/services/buildkite/default.nix
+++ b/modules/services/buildkite/default.nix
@@ -3,6 +3,17 @@ let
   cfg = config.my.services.buildkite;
   agents = lib.range 1 5;
   secrets = config.age.secrets;
+
+  my-gerrit-hook = name:
+    pkgs.writeShellScript "besadii-whitby" ''
+      exec -a ${name} ${pkgs.tools.gerrit-hook}/bin/gerrit-hook "$@"
+    '';
+
+  buildkiteHooks = pkgs.runCommandNoCC "buildkite-hooks" { } ''
+    mkdir -p $out/bin
+    ln -s ${my-gerrit-hook "post-command"} $out/bin/post-command
+  '';
+
 in {
   options.my.services.buildkite = with lib; {
     enable = mkEnableOption "buildkite agent";
@@ -17,6 +28,7 @@ in {
         inherit name;
         enable = true;
         tokenPath = secrets."buildkite/agent".path;
+        hooks.post-command = "${buildkiteHooks}/bin/post-command";
         runtimePackages = with pkgs; [
           bash
           coreutils