From 6acf96c42e2836b3ed77b8f269a1b3385910ce30 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 9 Jun 2022 13:39:18 -0700 Subject: feat(buildkite): configure the post-command hook Change-Id: I7b00987382ef05e032d88cf00e916cdc27511eb1 Reviewed-on: https://cl.fcuny.net/c/world/+/306 Reviewed-by: Franck Cuny --- modules/services/buildkite/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- cgit 1.4.1