#!/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-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} ;; 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