From 22762a7d1c52f863fdada8b49a6132484e87980f Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Wed, 15 Feb 2023 15:30:17 +0100 Subject: [PATCH] scripts: gceworker: don't anchor absolute paths at repo in get Now one may `./scripts/gceworker.ssh get /home/foo bar`. Previously it would try to copy from `go/src/github.com/cockroachdb/cockroach/home/foo/bar`. Epic: none Release note: None --- scripts/gceworker.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/gceworker.sh b/scripts/gceworker.sh index d89899df2fc5..e84caa3d957f 100755 --- a/scripts/gceworker.sh +++ b/scripts/gceworker.sh @@ -151,7 +151,13 @@ case "${cmd}" in gcloud "$@" ;; get) - from="${NAME}:go/src/github.com/cockroachdb/cockroach/${1}" + rpath="${1}" + # Check whether we have an absolute path like /foo, ~foo, or ~/foo. + # If not, base the path relative to the CRDB repo. + if [[ "${rpath:0:1}" != / && "${rpath:0:2}" != ~[/a-z] ]]; then + rpath="go/src/github.com/cockroachdb/cockroach/${rpath}" + fi + from="${NAME}:${rpath}" shift gcloud compute scp --recurse "${from}" "$@" ;;