From 6bee8e874123f35ad3414f4e51cda57804ae959b Mon Sep 17 00:00:00 2001 From: Scrum4Me Agent <30029041+madhura68@users.noreply.github.com> Date: Wed, 13 May 2026 19:45:36 +0200 Subject: [PATCH] feat(flows): add update_mcp_worker flow with git_status, force-recreate, and health check - update_mcp_worker.yml: git_status -> git_fetch -> git_pull (all cwd=scrum4me-docker) -> docker_compose_build -> docker_compose_up_recreate -> wait_for_health_worker - commands.yml.example: add docker_compose_up_recreate (--force-recreate) and wait_for_health_worker (polls /var/log/agent/current for 'pre-flight passed') Co-Authored-By: Claude Sonnet 4.6 --- ops-agent/commands.yml.example | 17 ++++++++++++++ ops-agent/flows.example/update_mcp_worker.yml | 23 +++++++++++-------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ops-agent/commands.yml.example b/ops-agent/commands.yml.example index 9bd052e..e899e0e 100644 --- a/ops-agent/commands.yml.example +++ b/ops-agent/commands.yml.example @@ -117,6 +117,16 @@ commands: - ops-dashboard description: "Start or recreate a docker compose service in detached mode" + docker_compose_up_recreate: + cmd: ["docker", "compose", "up", "-d", "--force-recreate"] + cwd: "/srv/scrum4me/compose" + args: + allowed: + - scrum4me-web + - worker-idea + - ops-dashboard + description: "Force-recreate a docker compose service (picks up a rebuilt image)" + git_pull: cmd: ["git", "pull", "--ff-only"] cwd_pattern: "/srv/" @@ -163,6 +173,13 @@ commands: cwd: "/srv/scrum4me/compose" description: "Verify worker-idea container is in the running state" + wait_for_health_worker: + cmd: + - sh + - -c + - "timeout 60 sh -c 'until grep -q \"pre-flight passed\" /var/log/agent/current 2>/dev/null; do sleep 3; done && echo \"pre-flight passed\"'" + description: "Wait up to 60s for MCP worker pre-flight check (/var/log/agent/current)" + # ── Scrum4Me web deployment steps ──────────────────────────────────────── npm_ci: diff --git a/ops-agent/flows.example/update_mcp_worker.yml b/ops-agent/flows.example/update_mcp_worker.yml index ef87339..56fdb82 100644 --- a/ops-agent/flows.example/update_mcp_worker.yml +++ b/ops-agent/flows.example/update_mcp_worker.yml @@ -2,30 +2,35 @@ # Copy to /etc/ops-agent/flows/update_mcp_worker.yml on the host. # # Steps: -# 1. Fetch remote refs -# 2. Fast-forward pull (aborts if working tree is dirty) -# 3. Rebuild the Docker image -# 4. Recreate the container in detached mode -# 5. Verify the container is running +# 1. Show current git status (informational) +# 2. Fetch remote refs +# 3. Fast-forward pull (aborts if working tree is dirty) +# 4. Rebuild the Docker image +# 5. Recreate the container in detached mode (force-recreate picks up new image) +# 6. Wait for worker pre-flight to pass (checks /var/log/agent/current) name: Update MCP Worker description: Pull latest code, rebuild Docker image, and restart the MCP worker service steps: + - command_key: git_status + args: ["/srv/scrum4me/repos/scrum4me-docker"] + on_failure: continue + - command_key: git_fetch - args: ["/srv/scrum4me"] + args: ["/srv/scrum4me/repos/scrum4me-docker"] on_failure: abort - command_key: git_pull - args: ["/srv/scrum4me"] + args: ["/srv/scrum4me/repos/scrum4me-docker"] on_failure: abort - command_key: docker_compose_build args: ["worker-idea"] on_failure: abort - - command_key: docker_compose_up + - command_key: docker_compose_up_recreate args: ["worker-idea"] on_failure: abort - - command_key: docker_compose_ps_worker + - command_key: wait_for_health_worker on_failure: continue