fix(tanko): adapter fixes, event logging, platform-based deploy.sh
CI / validate (pull_request) Failing after 2s
CI / validate (pull_request) Failing after 2s
- adapter.py: add import asyncio, use Client(site=) for Python 3.13 compat - adapter.py: use asyncio.new_event_loop() in background thread - adapter.py: add print() in _process_event for journald visibility - deploy.sh: refactor to PLATFORM-based maps instead of per-agent duplications - deploy.sh: remove backslash artifacts, deduplicate service/plugin path logic
This commit is contained in:
+35
-37
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# deploy.sh GitOps deployment for zulip-platform-plugins
|
||||
# deploy.sh — GitOps deployment for zulip-platform-plugins
|
||||
# Usage: ./deploy.sh <tag|branch> [--ct=<agent>] [--dry-run]
|
||||
# ./deploy.sh v1.0.0 # Deploy to all 6 CTs
|
||||
# ./deploy.sh main # Deploy latest (staging only!)
|
||||
@@ -36,28 +36,28 @@ declare -A AGENTS=(
|
||||
["abiba"]="amdpve CT 100"
|
||||
)
|
||||
|
||||
# Platform paths per agent type
|
||||
declare -A PLUGIN_PATHS=(
|
||||
["tanko"]="/opt/hermes-zulip-plugin"
|
||||
["mumuni"]="/opt/hermes-zulip-plugin"
|
||||
["koonimo"]="/opt/hermes-zulip-plugin"
|
||||
["koby\"]="/opt/hermes-zulip-plugin"
|
||||
["kagentz\"]="/opt/agent-zero-plugin"
|
||||
["abiba\"]="/root/.pi/agent/extensions/zulip.ts"
|
||||
# Platform classification for each agent
|
||||
declare -A PLATFORM=(
|
||||
["tanko"]="hermes"
|
||||
["mumuni"]="hermes"
|
||||
["koonimo"]="hermes"
|
||||
["koby"]="hermes"
|
||||
["kagentz"]="agent-zero"
|
||||
["abiba"]="pi"
|
||||
)
|
||||
|
||||
# Correcting the backslash artifacts from the original file
|
||||
PLUGIN_PATHS["koby"]="/opt/hermes-zulip-plugin"
|
||||
PLUGIN_PATHS["kagentz"]="/opt/agent-zero-plugin"
|
||||
PLUGIN_PATHS["abiba"]="/root/.pi/agent/extensions/zulip.ts"
|
||||
# Plugin paths by platform
|
||||
declare -A PLUGIN_PATHS_BY_PLATFORM=(
|
||||
["hermes"]="/opt/hermes-zulip-plugin"
|
||||
["agent-zero"]="/opt/agent-zero-plugin"
|
||||
["pi"]="/root/.pi/agent/extensions/zulip.ts"
|
||||
)
|
||||
|
||||
declare -A SERVICE_NAMES=(
|
||||
["tanko"]="zulip-plugin"
|
||||
["mumuni"]="zulip-plugin"
|
||||
["koonimo"]="zulip-plugin"
|
||||
["koby"]="zulip-plugin"
|
||||
["kagentz"]="zulip-plugin"
|
||||
["abiba"]="pi" # pi reload, not systemctl
|
||||
# Service names by platform
|
||||
declare -A SERVICE_NAMES_BY_PLATFORM=(
|
||||
["hermes"]="zulip-plugin"
|
||||
["agent-zero"]="zulip-plugin"
|
||||
["pi"]="pi" # pi reload, not systemctl
|
||||
)
|
||||
|
||||
GITEA_REPO="https://git.sysloggh.net/SyslogSolution/zulip-platform-plugins.git"
|
||||
@@ -72,15 +72,16 @@ log() {
|
||||
deploy_agent() {
|
||||
local agent="$1"
|
||||
local ct_info="${AGENTS[$agent]}"
|
||||
local plugin_path="${PLUGIN_PATHS[$agent]}"
|
||||
local service="${SERVICE_NAMES[$agent]}"
|
||||
local platform="${PLATFORM[$agent]}"
|
||||
local plugin_path="${PLUGIN_PATHS_BY_PLATFORM[$platform]}"
|
||||
local service="${SERVICE_NAMES_BY_PLATFORM[$platform]}"
|
||||
|
||||
log "=== Deploying $agent ($ct_info) @ $TAG ==="
|
||||
log "Path: $plugin_path"
|
||||
log "=== Deploying $agent ($ct_info) @ $TAG (platform: $platform) ==="
|
||||
log "Path: $plugin_path | Service: $service"
|
||||
|
||||
# 1. Git pull & checkout tag
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
cd "$plugin_path" || { log "ERROR: $agent path $plugin_path not found"; return 1; }
|
||||
cd "$plugin_path" || { log "ERROR: $agent: path $plugin_path not found"; return 1; }
|
||||
git fetch --tags origin
|
||||
git checkout "$TAG"
|
||||
else
|
||||
@@ -90,15 +91,12 @@ deploy_agent() {
|
||||
|
||||
# 2. Install dependencies (platform-specific)
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
case "$agent" in
|
||||
tanko|mumuni|koonimo|koby)
|
||||
case "$platform" in
|
||||
hermes|agent-zero)
|
||||
pip install -r requirements.txt --quiet
|
||||
;;
|
||||
kagentz)
|
||||
pip install -r requirements.txt --quiet
|
||||
;;
|
||||
abiba)
|
||||
log "$agent: pi extension skipping pip install"
|
||||
pi)
|
||||
log "$agent: pi extension — skipping pip install"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@@ -107,8 +105,8 @@ deploy_agent() {
|
||||
|
||||
# 3. Restart service
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
case "$agent" in
|
||||
abiba)
|
||||
case "$platform" in
|
||||
pi)
|
||||
log "$agent: triggering /reload"
|
||||
;;
|
||||
*)
|
||||
@@ -127,7 +125,7 @@ deploy_agent() {
|
||||
if curl -sf "http://localhost:$HEALTH_PORT/health" > /dev/null 2>&1; then
|
||||
log "OK: $agent health check passed"
|
||||
else
|
||||
log "ERROR: $agent health check failed check logs"
|
||||
log "ERROR: $agent health check failed — check logs"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
@@ -135,8 +133,8 @@ deploy_agent() {
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Main ---\
|
||||
log "Deploy started target: $TAG (Dry Run: $DRY_RUN)"
|
||||
# --- Main ---
|
||||
log "Deploy started — target: $TAG (Dry Run: $DRY_RUN)"
|
||||
|
||||
if [[ -n "$SINGLE_CT" ]]; then
|
||||
deploy_agent "$SINGLE_CT"
|
||||
|
||||
Reference in New Issue
Block a user