File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 shell : bash
2121 run : |
2222 echo '${{ inputs.service-key }}' | sudo twingate setup --headless=-
23- sudo twingate start
24- TWINGATE_STATUS=$(sudo twingate status)
25- if [[ "$TWINGATE_STATUS" != 'online' ]]; then
26- echo "Exiting with error as Twingate is not connected"
23+ MAX_RETRIES=5
24+ WAIT_TIME=5
25+ n=0
26+
27+ while [ $n -lt $MAX_RETRIES ]; do
28+ echo "Starting Twingate service..."
29+ sudo twingate start
30+
31+ echo "Waiting $WAIT_TIME seconds for Twingate service to start..."
32+ sleep $WAIT_TIME
33+
34+ status=$(sudo twingate status)
35+
36+ if [ "$status" = "online" ]; then
37+ echo "Twingate service is connected."
38+ break
39+ else
40+ sudo twingate stop
41+ fi
42+
43+ # Increment the retry counter and wait time
44+ n=$((n+1))
45+ WAIT_TIME=$((WAIT_TIME+5))
46+
47+ echo "Twingate service is not connected. Retrying ..."
48+ done
49+
50+ if [ $n -eq $MAX_RETRIES ]; then
51+ echo "Twingate service failed to connect."
2752 exit 1
28- fi
53+ fi
You can’t perform that action at this time.
0 commit comments