Merge pull request #65 from living-ip/codex/sync-leoclean-skills-20260709
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
Sync leoclean skills during deploy
This commit is contained in:
commit
3e6ac9b8e0
3 changed files with 28 additions and 2 deletions
|
|
@ -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_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills"
|
||||
SYSTEMD_DIR="/etc/systemd/system"
|
||||
STAMP_FILE="/opt/teleo-eval/.last-deploy-sha"
|
||||
LOG_TAG="auto-deploy"
|
||||
|
|
@ -93,12 +94,16 @@ 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-skills/vps ]; then
|
||||
mkdir -p "$LEOCLEAN_SKILLS_DIR"
|
||||
rsync "${RSYNC_OPTS[@]}" hermes-agent/leoclean-skills/vps/ "$LEOCLEAN_SKILLS_DIR/"
|
||||
fi
|
||||
[ -f research/research-session.sh ] && rsync "${RSYNC_OPTS[@]}" research/research-session.sh /opt/teleo-eval/research-session.sh
|
||||
|
||||
# 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"; do
|
||||
for dir in "$PIPELINE_DIR" "$TELEGRAM_DIR" "$DIAGNOSTICS_DIR" "$AGENT_STATE_DIR" "$LEOCLEAN_SKILLS_DIR"; do
|
||||
[ -d "$dir" ] || continue
|
||||
find "$dir" -maxdepth 3 -name '*.sh' -not -perm -u+x -exec chmod +x {} +
|
||||
done
|
||||
|
|
@ -154,10 +159,14 @@ 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
|
||||
add_restart_if_unit_active leoclean-gateway
|
||||
fi
|
||||
else
|
||||
RESTART="teleo-pipeline teleo-diagnostics"
|
||||
add_restart_if_unit_active teleo-agent@leo
|
||||
add_restart_if_unit_exists teleo-agent@leo-wallet-test
|
||||
add_restart_if_unit_active leoclean-gateway
|
||||
fi
|
||||
|
||||
if [ -n "$RESTART" ]; then
|
||||
|
|
|
|||
|
|
@ -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_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills"
|
||||
VPS_SYSTEMD="/etc/systemd/system"
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
|
|
@ -91,6 +92,10 @@ echo "=== Agent state ==="
|
|||
rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/agent-state/" "$VPS_HOST:$VPS_AGENT_STATE/"
|
||||
echo ""
|
||||
|
||||
echo "=== Leoclean skills ==="
|
||||
rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/hermes-agent/leoclean-skills/vps/" "$VPS_HOST:$VPS_LEOCLEAN_SKILLS/"
|
||||
echo ""
|
||||
|
||||
echo "=== Research session ==="
|
||||
rsync "${RSYNC_OPTS[@]}" "$REPO_ROOT/research/research-session.sh" "$VPS_HOST:/opt/teleo-eval/research-session.sh"
|
||||
echo ""
|
||||
|
|
@ -113,6 +118,6 @@ echo "Deploy complete."
|
|||
if $RESTART; then
|
||||
echo ""
|
||||
echo "=== Restarting services ==="
|
||||
ssh "$VPS_HOST" "sudo systemctl restart teleo-pipeline teleo-diagnostics; if systemctl is-active --quiet teleo-agent@leo.service; then sudo systemctl restart teleo-agent@leo; fi; if systemctl list-units --all --full teleo-agent@leo-wallet-test.service --no-legend | grep -q .; then sudo systemctl restart teleo-agent@leo-wallet-test; fi"
|
||||
ssh "$VPS_HOST" "sudo systemctl restart teleo-pipeline teleo-diagnostics; if systemctl is-active --quiet teleo-agent@leo.service; then sudo systemctl restart teleo-agent@leo; fi; if systemctl list-units --all --full teleo-agent@leo-wallet-test.service --no-legend | grep -q .; then sudo systemctl restart teleo-agent@leo-wallet-test; fi; if systemctl is-active --quiet leoclean-gateway.service; then sudo systemctl restart leoclean-gateway; fi"
|
||||
echo "Services restarted."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -78,3 +78,15 @@ def test_deploy_scripts_install_systemd_units_and_enable_agent_healthcheck():
|
|||
|
||||
assert 'VPS_SYSTEMD="/etc/systemd/system"' in manual_deploy
|
||||
assert "teleo-agent-healthcheck.timer" in manual_deploy
|
||||
|
||||
|
||||
def test_deploy_scripts_sync_leoclean_skills_and_restart_gateway_when_active():
|
||||
auto_deploy = (REPO_ROOT / "deploy" / "auto-deploy.sh").read_text()
|
||||
manual_deploy = (REPO_ROOT / "deploy" / "deploy.sh").read_text()
|
||||
|
||||
assert 'LEOCLEAN_SKILLS_DIR="/home/teleo/.hermes/profiles/leoclean/skills"' in auto_deploy
|
||||
assert 'hermes-agent/leoclean-skills/vps/' in auto_deploy
|
||||
assert 'add_restart_if_unit_active leoclean-gateway' in auto_deploy
|
||||
assert 'VPS_LEOCLEAN_SKILLS="/home/teleo/.hermes/profiles/leoclean/skills"' in manual_deploy
|
||||
assert 'hermes-agent/leoclean-skills/vps/' in manual_deploy
|
||||
assert 'systemctl is-active --quiet leoclean-gateway.service' in manual_deploy
|
||||
|
|
|
|||
Loading…
Reference in a new issue