fix: robust tailscaled startup in CI runner
This commit is contained in:
@@ -196,20 +196,28 @@ jobs:
|
||||
|
||||
- name: Start tailscaled daemon
|
||||
run: |
|
||||
mkdir -p /var/run/tailscale
|
||||
mkdir -p /var/lib/tailscale
|
||||
nohup tailscaled \
|
||||
--socket=/var/run/tailscale/tailscaled.sock \
|
||||
--state=/var/lib/tailscale/tailscaled.state \
|
||||
>/tmp/tailscaled.log 2>&1 &
|
||||
for i in $(seq 1 20); do
|
||||
tailscale --socket=/var/run/tailscale/tailscaled.sock status >/dev/null 2>&1 && break
|
||||
set -e
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl enable --now tailscaled || true
|
||||
fi
|
||||
if ! pgrep -x tailscaled >/dev/null 2>&1; then
|
||||
service tailscaled start || true
|
||||
fi
|
||||
if ! pgrep -x tailscaled >/dev/null 2>&1; then
|
||||
mkdir -p /var/run/tailscale /var/lib/tailscale
|
||||
nohup tailscaled --state=/var/lib/tailscale/tailscaled.state >/tmp/tailscaled.log 2>&1 &
|
||||
fi
|
||||
for i in $(seq 1 30); do
|
||||
tailscale status >/dev/null 2>&1 && exit 0
|
||||
sleep 1
|
||||
done
|
||||
echo "tailscaled failed to start"
|
||||
if [ -f /tmp/tailscaled.log ]; then cat /tmp/tailscaled.log; fi
|
||||
exit 1
|
||||
|
||||
- name: Connect runner to tailnet
|
||||
run: |
|
||||
tailscale --socket=/var/run/tailscale/tailscaled.sock up \
|
||||
tailscale up \
|
||||
--authkey "${{ secrets.TAILSCALE_CI_AUTH_KEY }}" \
|
||||
--hostname "gitea-runner-${{ github.run_number }}" \
|
||||
--ssh=false \
|
||||
@@ -217,8 +225,8 @@ jobs:
|
||||
|
||||
- name: Verify runner tailnet status
|
||||
run: |
|
||||
tailscale --socket=/var/run/tailscale/tailscaled.sock status
|
||||
tailscale --socket=/var/run/tailscale/tailscaled.sock ip -4
|
||||
tailscale status
|
||||
tailscale ip -4
|
||||
|
||||
- name: Install Ansible Collections
|
||||
run: ansible-galaxy collection install -r ansible/requirements.yml
|
||||
|
||||
Reference in New Issue
Block a user