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 <mail@tazj.in> Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
929bb840a6
commit
406a66bed1
3 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
1
bin/gerrit
Symbolic link
1
bin/gerrit
Symbolic link
|
@ -0,0 +1 @@
|
|||
__dispatch.sh
|
13
tools/gerrit-cli.nix
Normal file
13
tools/gerrit-cli.nix
Normal file
|
@ -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 $@
|
||||
''
|
Loading…
Reference in a new issue