summaryrefslogtreecommitdiffstats
path: root/jjb/scripts/setup_executor_env.sh
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2022-10-19 21:48:45 -0400
committerDave Wallace <dwallacelf@gmail.com>2022-10-19 21:48:45 -0400
commitff9238d6ca62a5601e6dd3cc4307f7f80bed8c76 (patch)
treed595cbd76acbafc56d35832c3039b002c4779a72 /jjb/scripts/setup_executor_env.sh
parent8692d97f1688b603c39ae6a1faf2655d4f27762f (diff)
Fix Nomad hostname output in docker job console logs.
Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: If88be92314290bd2b2d0b1bbb21167b6286b8155
Diffstat (limited to 'jjb/scripts/setup_executor_env.sh')
-rwxr-xr-xjjb/scripts/setup_executor_env.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/jjb/scripts/setup_executor_env.sh b/jjb/scripts/setup_executor_env.sh
index 4d3cb6ec..72782490 100755
--- a/jjb/scripts/setup_executor_env.sh
+++ b/jjb/scripts/setup_executor_env.sh
@@ -25,12 +25,22 @@ file_delimiter="----- %< -----"
long_line="************************************************************************"
downloads_cache="/root/Downloads"
+# Requires all nomad client machines to run the following command
+# and mount /scratch/nomad into the docker container:
+# sudo mkdir -p /scratch/nomad && echo "$(hostname)-$(uname -m)" | sudo tee /scratch/nomad/nomad-client
+nomad_client_file="/scratch/nomad/nomad-client"
+if [ -f "$nomad_client_file" ] ; then
+ NOMAD_CLIENT="$(cat $nomad_client_file)"
+else
+ NOMAD_CLIENT="Unknown"
+fi
+
# Node info
echo "$long_line"
echo "Executor Runtime Attributes:"
echo "OS: $OS_ID-$OS_VERSION_ID"
echo "Arch: $OS_ARCH"
-echo "Nomad Hostname: $(grep search /etc/resolv.conf | cut -d' ' -f2 | head -1)"
+echo "Nomad Client Hostname: $NOMAD_CLIENT"
echo "Container ID: $(hostname)"
echo "$long_line"