fix(ops): Correctly pass command name to besadii invocations

Ensure that besadii sees $0 as the correct command name, since that is
the sole mechanism by which its functionality is switched around.

There was a lingering commit that introduced this bug and hadn't been
deployed in a couple of days. Maybe time to tighten deploy cycles soon
...

Change-Id: Ie4284c0f6e5e06d71a71a3702ec7e092260e0ce5
This commit is contained in:
Vincent Ambo 2021-12-06 19:19:05 +03:00 committed by tazjin
parent 6ef5162a93
commit 6faf0edaff
2 changed files with 7 additions and 7 deletions

View file

@ -4,15 +4,15 @@
let
cfg = config.services.gerrit;
besadiiWithConfig = pkgs.writeShellScript "besadii-whitby" ''
besadiiWithConfig = name: pkgs.writeShellScript "besadii-whitby" ''
export BESADII_CONFIG=/etc/secrets/besadii.json
exec ${depot.ops.besadii}/bin/besadii
exec -a ${name} ${depot.ops.besadii}/bin/besadii "$@"
'';
gerritHooks = pkgs.runCommandNoCC "gerrit-hooks" {} ''
mkdir -p $out
ln -s ${besadiiWithConfig} $out/change-merged
ln -s ${besadiiWithConfig} $out/patchset-created
ln -s ${besadiiWithConfig "change-merged"} $out/change-merged
ln -s ${besadiiWithConfig "patchset-created"} $out/patchset-created
'';
in {
services.gerrit = {

View file

@ -6,16 +6,16 @@ let
agents = lib.range 1 cfg.agentCount;
description = "Buildkite agents for TVL";
besadiiWithConfig = pkgs.writeShellScript "besadii-whitby" ''
besadiiWithConfig = name: pkgs.writeShellScript "besadii-whitby" ''
export BESADII_CONFIG=/etc/secrets/besadii.json
exec ${depot.ops.besadii}/bin/besadii
exec -a ${name} ${depot.ops.besadii}/bin/besadii "$@"
'';
# All Buildkite hooks are actually besadii, but it's being invoked
# with different names.
buildkiteHooks = pkgs.runCommandNoCC "buildkite-hooks" {} ''
mkdir -p $out/bin
ln -s ${besadiiWithConfig} $out/bin/post-command
ln -s ${besadiiWithConfig "post-command"} $out/bin/post-command
'';
in {
options.services.depot.buildkite = {