54 lines
1.7 KiB
YAML
54 lines
1.7 KiB
YAML
name: komodo-check
|
|
|
|
# One-off diagnostic: lists Komodo stacks and reports the qbit-maid stack's
|
|
# auto_pull setting. Safe to delete after use.
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- komodo-check
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Query Komodo
|
|
env:
|
|
KOMODO_URL: '${{ secrets.KOMODO_URL }}'
|
|
KOMODO_API_KEY: '${{ secrets.KOMODO_API_KEY }}'
|
|
KOMODO_API_SECRET: '${{ secrets.KOMODO_API_SECRET }}'
|
|
run: |
|
|
set -eu
|
|
KOMODO_URL="${KOMODO_URL%/}"
|
|
api() {
|
|
curl -sS -X POST "${KOMODO_URL}$1" \
|
|
-H 'Content-Type: application/json' \
|
|
-H "x-api-key: ${KOMODO_API_KEY}" \
|
|
-H "x-api-secret: ${KOMODO_API_SECRET}" \
|
|
-d "$2"
|
|
}
|
|
|
|
echo "===== ListStacks ====="
|
|
api /read/ListStacks '{}' > /tmp/stacks.json
|
|
python3 - <<'PY'
|
|
import json
|
|
d = json.load(open('/tmp/stacks.json'))
|
|
if isinstance(d, dict):
|
|
print("unexpected dict:", list(d)[:10])
|
|
else:
|
|
for s in d:
|
|
print(f" name={s.get('name')!r} id={s.get('id')!r} server={s.get('server_id')!r}")
|
|
PY
|
|
|
|
echo "===== GetStack qbit-maid ====="
|
|
api /read/GetStack '{"stack":"qbit-maid"}' > /tmp/stack.json
|
|
python3 - <<'PY'
|
|
import json
|
|
d = json.load(open('/tmp/stack.json'))
|
|
cfg = d.get('config', {}) if isinstance(d, dict) else {}
|
|
print(" name:", d.get('name'))
|
|
print(" auto_pull:", cfg.get('auto_pull'))
|
|
print(" server_id:", d.get('server_id'))
|
|
print(" config keys:", sorted(cfg.keys()))
|
|
PY
|