Compare commits
3 Commits
2d455929bd
...
a891109ee9
| Author | SHA1 | Date | |
|---|---|---|---|
| a891109ee9 | |||
| 0ea9888854 | |||
| 3261b18f37 |
@@ -96,6 +96,7 @@ jobs:
|
|||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import urllib.error
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ jobs:
|
|||||||
payload = resp.read().decode("utf-8")
|
payload = resp.read().decode("utf-8")
|
||||||
return json.loads(payload)
|
return json.loads(payload)
|
||||||
|
|
||||||
def wait_for_guest_agent(vmid, timeout_seconds=300):
|
def wait_for_guest_agent(vmid, timeout_seconds=120):
|
||||||
deadline = time.time() + timeout_seconds
|
deadline = time.time() + timeout_seconds
|
||||||
tries = 0
|
tries = 0
|
||||||
while time.time() < deadline:
|
while time.time() < deadline:
|
||||||
@@ -155,8 +156,14 @@ jobs:
|
|||||||
if res.get("data") == "pong":
|
if res.get("data") == "pong":
|
||||||
print(f"Guest agent ready for vmid {vmid}", flush=True)
|
print(f"Guest agent ready for vmid {vmid}", flush=True)
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except urllib.error.HTTPError as exc:
|
||||||
pass
|
detail = exc.read().decode("utf-8", "ignore")
|
||||||
|
print(f"Agent ping HTTP error for vmid {vmid}: {exc.code} {detail}", flush=True)
|
||||||
|
if exc.code in (401, 403):
|
||||||
|
return False
|
||||||
|
except Exception as exc:
|
||||||
|
if tries == 1:
|
||||||
|
print(f"Agent ping error for vmid {vmid}: {exc}", flush=True)
|
||||||
if tries % 6 == 0:
|
if tries % 6 == 0:
|
||||||
remaining = int(deadline - time.time())
|
remaining = int(deadline - time.time())
|
||||||
print(f"Waiting for guest agent on vmid {vmid} ({remaining}s left)", flush=True)
|
print(f"Waiting for guest agent on vmid {vmid} ({remaining}s left)", flush=True)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cat > secrets.auto.tfvars << EOF
|
cat > secrets.auto.tfvars << EOF
|
||||||
pm_api_token_secret = "${{ secrets.PM_API_TOKEN_SECRET }}"
|
pm_api_token_secret = "${{ secrets.PM_API_TOKEN_SECRET }}"
|
||||||
|
SSH_KEY_PUBLIC = "$(printf '%s' "${{ secrets.SSH_KEY_PUBLIC }}" | tr -d '\r\n')"
|
||||||
EOF
|
EOF
|
||||||
cat > backend.hcl << EOF
|
cat > backend.hcl << EOF
|
||||||
bucket = "${{ secrets.B2_TF_BUCKET }}"
|
bucket = "${{ secrets.B2_TF_BUCKET }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user