summaryrefslogtreecommitdiff
path: root/jenkins-helpers.sh
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2019-03-25 09:42:13 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2019-03-25 10:09:10 +0000
commit2fd1e2bcf8ffee502dcbfc7f2f9e4ba705b72466 (patch)
tree1aa0a9f8fe7f3f990f274f631c2e74609ad09034 /jenkins-helpers.sh
parent954b5213435bb4e25b0fea128f59d0ccd2f5c383 (diff)
docker-run.sh, jenkins-helpers.sh: Fix use of flock
flock expects a real command as argument, not a shell function, so the scripts are currently broken: flock: failed to execute container_exec: No such file or directory This patch defines the JENKINS_FLOCK helper variable which is expanded by the remote_exec() shell helper. Change-Id: Ie5117d1116c9bbc9b556bc25946a7a0afc706ea2
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r--jenkins-helpers.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 65428d9a..6119bab5 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -270,7 +270,8 @@ remote_exec ()
# 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 "${env_vars:+export $env_vars && }${dir:+cd "$(printf '%q' "$dir")" && exec }${cmd[@]}"
+ # We use flock if $JENKINS_FLOCK is set.
+ ${JENKINS_FLOCK+$JENKINS_FLOCK} ssh $opts ${port:+-p$port} $host "${env_vars:+export $env_vars && }${dir:+cd "$(printf '%q' "$dir")" && exec }${cmd[@]}"
)
}