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