feat: add Telegram notifications to PostSync smoke tests + new tests for researchowl/openclaw
- Create telegram-notify secret in n8n, portfolio, polymarket-bot, researchowl, openclaw namespaces (values mirrored from monitoring/grafana-telegram) - Update existing smoke tests (n8n, portfolio, polymarket-bot) to send [OK]/[FAIL] Telegram notifications on success/failure - Add postsync-smoke-test for openclaw (curl GET / on port 18789) - Add postsync-smoke-test for researchowl (no HTTP port; checks readyReplicas via k8s API using a smoke-test-reader ServiceAccount + Role + RoleBinding) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: postsync-smoke-test
|
||||
namespace: researchowl
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PostSync
|
||||
argocd.argoproj.io/hook-delete-policy: HookSucceeded
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 600
|
||||
backoffLimit: 0
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: smoke-test-reader
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: smoke-test
|
||||
image: curlimages/curl:latest
|
||||
env:
|
||||
- name: TELEGRAM_BOT_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: telegram-notify
|
||||
key: TELEGRAM_BOT_TOKEN
|
||||
- name: TELEGRAM_CHAT_ID
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: telegram-notify
|
||||
key: TELEGRAM_CHAT_ID
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
set -e
|
||||
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||
CACERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||
K8S_API="https://kubernetes.default.svc"
|
||||
|
||||
notify() {
|
||||
curl -s --max-time 10 -X POST \
|
||||
"https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
--data-urlencode "text=$1" \
|
||||
> /dev/null || true
|
||||
}
|
||||
|
||||
fail() {
|
||||
notify "[FAIL] researchowl PostSync: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "--- [1/1] Deployment researchowl ready replicas ---"
|
||||
DEPLOY=$(curl -sf --max-time 15 \
|
||||
--header "Authorization: Bearer $TOKEN" \
|
||||
--cacert "$CACERT" \
|
||||
"$K8S_API/apis/apps/v1/namespaces/researchowl/deployments/researchowl") \
|
||||
|| fail "k8s API unreachable"
|
||||
|
||||
READY=$(echo "$DEPLOY" | grep -o '"readyReplicas":[0-9]*' | grep -o '[0-9]*' || echo "0")
|
||||
[ "${READY:-0}" -ge 1 ] || fail "readyReplicas=${READY:-0} (expected >= 1)"
|
||||
echo "readyReplicas=$READY — OK"
|
||||
|
||||
notify "[OK] researchowl PostSync passed — deployment ready"
|
||||
echo "=== researchowl: all smoke tests passed ==="
|
||||
Reference in New Issue
Block a user