feat(besadii): Implement support for Buildkite's post-command hook

This hook is invoked by Buildkite (on the runner) after every build
stage. This change adds support in Besadii to run as this hook and
update the build status on a Gerrit CL.

Change-Id: Ie07a94d9b41645a77681cf42f6969d218abf93c1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/761
Tested-by: BuildkiteCI
Reviewed-by: Kane York <rikingcoding@gmail.com>
This commit is contained in:
Vincent Ambo 2020-06-29 03:35:39 +01:00 committed by tazjin
parent f28b0d01ef
commit 6d3a9e7b5f
2 changed files with 127 additions and 20 deletions

View file

@ -12,6 +12,13 @@ config: let
frogEmacs = (depot.users.tazjin.emacs.overrideEmacs(epkgs: epkgs ++ [
depot.third_party.emacsPackages.google-c-style
]));
# 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
'';
in depot.lib.fix(self: {
imports = [
"${depot.depotPath}/ops/nixos/v4l2loopback.nix"
@ -198,6 +205,7 @@ in depot.lib.fix(self: {
services.buildkite-agents.frog = {
enable = true;
tokenPath = "/etc/secrets/buildkite-token";
hooks.post-command = "${buildkiteHooks}/bin/post-command";
};
environment.systemPackages =