about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xbin/__dispatch.sh3
l---------bin/gerrit1
-rw-r--r--tools/gerrit-cli.nix13
3 files changed, 17 insertions, 0 deletions
diff --git a/bin/__dispatch.sh b/bin/__dispatch.sh
index d8214bccd0d5..eddc20889377 100755
--- a/bin/__dispatch.sh
+++ b/bin/__dispatch.sh
@@ -50,6 +50,9 @@ case "${TARGET_TOOL}" in
   depot-build)
     attr="tools.depot-build"
     ;;
+  gerrit)
+    attr="tools.gerrit-cli"
+    ;;
   *)
     echo "The tool '${TARGET_TOOL}' is currently not installed in this repository."
     exit 1
diff --git a/bin/gerrit b/bin/gerrit
new file mode 120000
index 000000000000..8390ec9c9652
--- /dev/null
+++ b/bin/gerrit
@@ -0,0 +1 @@
+__dispatch.sh
\ No newline at end of file
diff --git a/tools/gerrit-cli.nix b/tools/gerrit-cli.nix
new file mode 100644
index 000000000000..853f59fb63aa
--- /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 $@
+''