From 4af1d765600c3a971c15a3baf21daa425391d1ea Mon Sep 17 00:00:00 2001 From: Thomas Carmet <8408330+tcarmet@users.noreply.github.com> Date: Tue, 2 Apr 2024 21:12:45 +0000 Subject: [PATCH] Ensure hostname is defined --- runner_manager/bin/startup.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runner_manager/bin/startup.sh b/runner_manager/bin/startup.sh index db275cee..88ca7c76 100755 --- a/runner_manager/bin/startup.sh +++ b/runner_manager/bin/startup.sh @@ -87,6 +87,18 @@ WantedBy=multi-user.target" | sudo tee /etc/systemd/system/actions.runner.servic } +function setup_hostname { + # Ensure the hostname is defined in /etc/hosts + local hostname + hostname=$(hostname) + + # Check if the hostname is in /etc/hosts + if ! grep -q "${hostname}" /etc/hosts; then + # If it's not in the file, append it + echo "127.0.0.1 ${hostname}" | sudo tee -a /etc/hosts + fi +} + function setup_runner { sudo groupadd -f docker sudo useradd -m actions @@ -220,4 +232,5 @@ done init install_docker +setup_hostname setup_runner