summaryrefslogtreecommitdiff
path: root/jenkins-helpers.sh
diff options
context:
space:
mode:
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r--jenkins-helpers.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index a2fb51d7..5a471800 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -152,6 +152,11 @@ print_host_for_node ()
# configured ssh
local host="$1.tcwglab"
+ # Map tcwg-x86_64-build-* and tcwg-x86_64-dev-* to build-* and dev-*
+ case "$host" in
+ tcwg-x86_64-*) host=${host#tcwg-x86_64-} ;;
+ esac
+
if ! host "$host" >& /dev/null; then
# No DNS entry, try to see if it is handled by our ssh config
if ! ssh "$1" true >& /dev/null; then
@@ -236,7 +241,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[@]}"
)
}
@@ -669,7 +677,9 @@ print_docker_path ()
if [ -f "/.dockerenv" ] && mount | grep -q "/run/docker.sock "; then
# If inside "host" container (with proxied docker and /home from host-home volume),
# convert paths to refer to volume's path on bare-metal.
- echo "$path" | sed -e "s#^/home/#/var/lib/docker/volumes/host-home/_data/#"
+ local docker_root
+ docker_root=$(docker info | grep "Docker Root Dir:" | cut -d: -f 2)
+ echo "$path" | sed -e "s#^/home/#$docker_root/volumes/host-home/_data/#"
else
echo "$path"
fi