diff options
author | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2019-02-12 19:41:45 +0530 |
---|---|---|
committer | Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> | 2019-02-12 19:41:45 +0530 |
commit | 8028d1160dbcf1defe5e4853a9f0bcfa68c115cb (patch) | |
tree | d18b5aefb3d3a8bf25d9ff7c26c93a0d3adbfe8e /jenkins-helpers.sh | |
parent | a797f90814f5b0b8f31d4e97c3cf72db84f04d31 (diff) | |
parent | 99300555a21d0ef961d60042730afe5b79d3311a (diff) |
Merge branch 'master' into tcwg_gnu
Change-Id: Ifd517229bb3ee7642266e3e66a8682f177992076
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r-- | jenkins-helpers.sh | 14 |
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 |