diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2017-02-01 09:07:09 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2017-02-01 16:25:46 +0000 |
commit | 614d76da5beedff2e2ef732e35a77d9875c566a6 (patch) | |
tree | 97bcbf08c6fa2c36f3011f2fe6dccdf12ee8fd59 | |
parent | 669e1d136488def6dbd03ecdab533ab9e884f11d (diff) |
nodename2hostname.sh: New helper script.
Converts Jenkins' NODE_NAME into a host name suitable for ssh from another machine in tcwg lab.
Change-Id: If7bca84ddfbedf0ac263f0393ff5baa5d0d31021
-rwxr-xr-x | nodename2hostname.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/nodename2hostname.sh b/nodename2hostname.sh new file mode 100755 index 00000000..6f401715 --- /dev/null +++ b/nodename2hostname.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# This script converts Jenkins' NODE_NAME to the public hostname. +# This is needed because on some machines `hostname` does not return +# the name as known by the DNS (eg. "tegra-ubuntu"). This list needs +# to be kept up-to-date with Jenkins configuration, and don't forget +# that a single host can have several NODE_NAMES. + +# FIXME: try to get rid of this script, it's going to be a maintenance +# nightmare :-) + +ID=$(echo ${NODE_NAME} | sed 's/.*-\([0-9][0-9]\)$/\1/') +NAME= +case ${NODE_NAME} in + tcwg-aarch64-build-0[1-2]) NAME=apm-${ID} ;; + tcwg-aarch64-test-0[1-2]) NAME=test-armv8-${ID} ;; + tcwg-bmk-tk1-0[6-8]) NAME=build-${ID} ;; + tcwg-bmk-tx1-0[6-8]) NAME=build-${ID} ;; + tcwg-tk1-0[1-5]) NAME=${NODE_NAME} ;; + tcwg-tx1-0[1-5]) NAME=${NODE_NAME} ;; + tcwg-x86_64-build-0[1-8]) NAME=build-${ID} ;; + tcwg-x86_64-dev-0[1-2]) NAME=dev-${ID} ;; + tcwg-x86_64-dev-0[1-2]-short) + ID=$(echo ${NODE_NAME} | sed 's/.*-\([0-9][0-9]\)-short$/\1/') + NAME=dev-${ID} + ;; + "") + echo "Error: NODE_NAME is not defined." 1>&2 + exit 1 + ;; + *) + echo "Error: unsupported NODE_NAME value: ${NODE_NAME}" 1>&2 + exit 1 + ;; +esac + +echo ${NAME} +exit 0 |