blob: f46ba3e4b46a05565393601366ac8efd6e28a135 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/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 :-)
# Save stdout/stderr file descriptors
exec 3>&1 4>&2
# Make sure all output goes to stderr
exec 1>&2
NODE=$1
if [ x"$NODE" = x ]; then
echo "Usage: $0 node-name"
exit 1
fi
ID=$(echo ${NODE} | sed 's/.*-\([0-9][0-9]\)$/\1/')
NAME=
case ${NODE} in
tcwg-apm-0[1-2]) NAME=apm-${ID} ;;
tcwg-apm-0[3-4]) NAME=test-armv8-$(echo "${ID}" | sed -e 'y/34/12/') ;;
tcwg-bmk-*) NAME=dev-01 ;;
tcwg-tk1-0[1-5]) NAME=${NODE} ;;
tcwg-tx1-0[1-5]) NAME=${NODE} ;;
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} | sed 's/.*-\([0-9][0-9]\)-short$/\1/')
NAME=dev-${ID}
;;
*)
echo "Error: unsupported NODE value: ${NODE}"
exit 1
;;
esac
# Restore stdout/stderr, so that expected output goes to stdout
exec 1>&3 2>&4
echo ${NAME}
exit 0
|