summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-01-30 08:22:15 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-02-07 12:30:51 +0000
commit20471672bdce1df18a7124e71f95b5575a102013 (patch)
tree1b780a75497a5929606d58293bac630b6b90196a
parentfe0640744ecc8baec0e937c8f724bdece9f302fe (diff)
jenkins-helpers.sh: Improve remote_exec
Don't add "exec" to the remote command unless necessary. We need this to trigger jenkins jobs via === remote_exec "ci.linaro.org:2222::-l $USER@linaro.org" build ... === Note that "build" is a command of jenkins-cli, not an executable, so prepending "exec" breaks the invocation. Change-Id: If122869dadb76711666aa49690f508757e7ebce9
-rw-r--r--jenkins-helpers.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 10b7081a..57e4b4f5 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -236,7 +236,10 @@ remote_exec ()
cmd=()
# Add quotes to every parameter
for i in "$@"; do cmd+=("$(printf '%q' "$i")"); done
- ssh $opts ${port:+-p$port} $host "${dir:+cd "$(printf '%q' "$dir")" &&} exec ${cmd[@]}"
+ # Be careful to prepend statements before ${cmd[@]} only if necessary.
+ # E.g., when triggering jobs via jenkins-cli, the command is not a binary,
+ # so we can't "exec" it.
+ ssh $opts ${port:+-p$port} $host "${dir:+cd "$(printf '%q' "$dir")" && exec }${cmd[@]}"
)
}