Skip to content

Commit 332b839

Browse files
Improve deploy VM check diagnostics
1 parent ca167e7 commit 332b839

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ jobs:
6262
- name: Is there a computer VM?
6363
id: check
6464
run: |
65-
n=$(ssh -i ~/.ssh/id_ed25519 exe.dev ls --l --json \
66-
| jq -r --arg tag "$VM_TAG" '[.vms[] | select((.tags // []) | index($tag))] | length')
65+
if ! ssh -i ~/.ssh/id_ed25519 exe.dev ls --l --json > vms.json; then
66+
echo "exe.dev VM listing failed"
67+
exit 1
68+
fi
69+
if ! jq -e . vms.json >/dev/null; then
70+
echo "exe.dev VM listing did not return JSON; raw output follows:"
71+
sed -n '1,80p' vms.json
72+
exit 1
73+
fi
74+
n=$(jq -r --arg tag "$VM_TAG" '[.vms[] | select((.tags // []) | index($tag))] | length' vms.json)
6775
echo "found $n VM(s) tagged $VM_TAG"
6876
if [ "$n" -gt 0 ]; then echo "exists=true"; else echo "exists=false"; fi >> "$GITHUB_OUTPUT"
6977

0 commit comments

Comments
 (0)