From 406a66bed11c273d279bc1470d44e80c354f8d98 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 15 Jun 2020 20:54:26 -0400 Subject: feat(gerrit-cli): Add gerrit CLI script Add a script to run gerrit commands on the depot host, which reads the gerrit username from the TVL_USERNAME env var or $(whoami) by default. At some point this may want to solve the configuration problem in a more general fashion, but for now this seems relatively obvious. Change-Id: Ied91c1d26daf4770aef74b2e755d1760c486bb7b Reviewed-on: https://cl.tvl.fyi/c/depot/+/396 Reviewed-by: tazjin Reviewed-by: glittershark --- tools/gerrit-cli.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tools/gerrit-cli.nix (limited to 'tools/gerrit-cli.nix') diff --git a/tools/gerrit-cli.nix b/tools/gerrit-cli.nix new file mode 100644 index 0000000000..853f59fb63 --- /dev/null +++ b/tools/gerrit-cli.nix @@ -0,0 +1,13 @@ +# Utility script to run a gerrit command on the depot host via ssh. +# Reads the username from TVL_USERNAME, or defaults to $(whoami) +{ pkgs, ... }: + +pkgs.writeShellScriptBin "gerrit" '' + TVL_USERNAME=''${TVL_USERNAME:-$(whoami)} + if $(which ssh 2>/dev/null); then + ssh=ssh + else + ssh="${pkgs.openssh}/bin/ssh" + fi + $ssh $TVL_USERNAME@code.tvl.fyi -p 29418 -- gerrit $@ +'' -- cgit 1.4.1