Skip to content

Commit

Permalink
Ensure hostname is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Apr 2, 2024
1 parent 6e26d1c commit 4af1d76
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions runner_manager/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -220,4 +232,5 @@ done

init
install_docker
setup_hostname
setup_runner

0 comments on commit 4af1d76

Please sign in to comment.