diff --git a/deploy/auto-deploy.sh b/deploy/auto-deploy.sh index 5e83003..f191303 100755 --- a/deploy/auto-deploy.sh +++ b/deploy/auto-deploy.sh @@ -16,6 +16,7 @@ PIPELINE_DIR="/opt/teleo-eval/pipeline" TELEGRAM_DIR="/opt/teleo-eval/telegram" DIAGNOSTICS_DIR="/opt/teleo-eval/diagnostics" AGENT_STATE_DIR="/opt/teleo-eval/ops/agent-state" +LEOCLEAN_BIN_DIR="/home/teleo/.hermes/profiles/leoclean/bin" LEOCLEAN_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills" SYSTEMD_DIR="/etc/systemd/system" STAMP_FILE="/opt/teleo-eval/.last-deploy-sha" @@ -94,6 +95,10 @@ rsync "${RSYNC_OPTS[@]}" telegram/ "$TELEGRAM_DIR/" rsync "${RSYNC_OPTS[@]}" diagnostics/ "$DIAGNOSTICS_DIR/" rsync "${RSYNC_OPTS[@]}" agent-state/ "$AGENT_STATE_DIR/" rsync "${RSYNC_OPTS[@]}" tests/ "$PIPELINE_DIR/tests/" +if [ -d hermes-agent/leoclean-bin ]; then + mkdir -p "$LEOCLEAN_BIN_DIR" + rsync "${RSYNC_OPTS[@]}" hermes-agent/leoclean-bin/ "$LEOCLEAN_BIN_DIR/" +fi if [ -d hermes-agent/leoclean-skills/vps ]; then mkdir -p "$LEOCLEAN_SKILLS_DIR" rsync "${RSYNC_OPTS[@]}" hermes-agent/leoclean-skills/vps/ "$LEOCLEAN_SKILLS_DIR/" @@ -103,7 +108,7 @@ fi # Safety net: ensure synced .sh files are executable after rsync. # Keep this bounded to deploy-owned paths: /opt/teleo-eval also contains # backups and generated state that may be unreadable by the deploy user. -for dir in "$PIPELINE_DIR" "$TELEGRAM_DIR" "$DIAGNOSTICS_DIR" "$AGENT_STATE_DIR" "$LEOCLEAN_SKILLS_DIR"; do +for dir in "$PIPELINE_DIR" "$TELEGRAM_DIR" "$DIAGNOSTICS_DIR" "$AGENT_STATE_DIR" "$LEOCLEAN_BIN_DIR" "$LEOCLEAN_SKILLS_DIR"; do [ -d "$dir" ] || continue find "$dir" -maxdepth 3 -name '*.sh' -not -perm -u+x -exec chmod +x {} + done @@ -159,7 +164,7 @@ if [ "$OLD_SHA" != "none" ]; then if git diff --name-only "$OLD_SHA" "$NEW_SHA" -- diagnostics/ 2>/dev/null | grep -q '\.py$'; then add_restart teleo-diagnostics fi - if git diff --name-only "$OLD_SHA" "$NEW_SHA" -- hermes-agent/leoclean-skills/vps/ 2>/dev/null | grep -q .; then + if git diff --name-only "$OLD_SHA" "$NEW_SHA" -- hermes-agent/leoclean-bin/ hermes-agent/leoclean-skills/vps/ 2>/dev/null | grep -q .; then add_restart_if_unit_active leoclean-gateway fi else diff --git a/deploy/deploy.sh b/deploy/deploy.sh index c9ab2e0..1206293 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -10,6 +10,7 @@ VPS_PIPELINE="/opt/teleo-eval/pipeline" VPS_TELEGRAM="/opt/teleo-eval/telegram" VPS_DIAGNOSTICS="/opt/teleo-eval/diagnostics" VPS_AGENT_STATE="/opt/teleo-eval/ops/agent-state" +VPS_LEOCLEAN_BIN="/home/teleo/.hermes/profiles/leoclean/bin" VPS_LEOCLEAN_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills" VPS_SYSTEMD="/etc/systemd/system" REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" @@ -92,6 +93,10 @@ echo "=== Agent state ===" rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/agent-state/" "$VPS_HOST:$VPS_AGENT_STATE/" echo "" +echo "=== Leoclean bin ===" +rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/hermes-agent/leoclean-bin/" "$VPS_HOST:$VPS_LEOCLEAN_BIN/" +echo "" + echo "=== Leoclean skills ===" rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/hermes-agent/leoclean-skills/vps/" "$VPS_HOST:$VPS_LEOCLEAN_SKILLS/" echo "" diff --git a/tests/test_teleo_agent_systemd.py b/tests/test_teleo_agent_systemd.py index 38a3bab..f578231 100644 --- a/tests/test_teleo_agent_systemd.py +++ b/tests/test_teleo_agent_systemd.py @@ -85,14 +85,19 @@ def test_deploy_scripts_sync_leoclean_skills_and_restart_gateway_when_active(): manual_deploy = (REPO_ROOT / "deploy" / "deploy.sh").read_text() sudoers = (REPO_ROOT / "deploy" / "sudoers" / "teleo-auto-deploy").read_text() + assert 'LEOCLEAN_BIN_DIR="/home/teleo/.hermes/profiles/leoclean/bin"' in auto_deploy assert 'LEOCLEAN_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills"' in auto_deploy + assert 'hermes-agent/leoclean-bin/' in auto_deploy assert 'hermes-agent/leoclean-skills/vps/' in auto_deploy + assert 'git diff --name-only "$OLD_SHA" "$NEW_SHA" -- hermes-agent/leoclean-bin/ hermes-agent/leoclean-skills/vps/' in auto_deploy assert 'add_restart_if_unit_active leoclean-gateway' in auto_deploy assert 'sudo systemctl restart "$svc"' in auto_deploy assert "sudo systemctl restart $RESTART" not in auto_deploy assert "NOPASSWD: /usr/bin/systemctl restart leoclean-gateway" in sudoers assert "NOPASSWD: /bin/systemctl restart leoclean-gateway" in sudoers + assert 'VPS_LEOCLEAN_BIN="/home/teleo/.hermes/profiles/leoclean/bin"' in manual_deploy assert 'VPS_LEOCLEAN_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills"' in manual_deploy + assert 'hermes-agent/leoclean-bin/' in manual_deploy assert 'hermes-agent/leoclean-skills/vps/' in manual_deploy assert 'systemctl is-active --quiet leoclean-gateway.service' in manual_deploy