Skip to content

Commit e6edb82

Browse files
committed
Implement zero-touch retry mechanism for code-sync deployment to handle Multi-Attach issues
1 parent cab7d8f commit e6edb82

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,42 @@ jobs:
7979
# at startup and registers the `--scale` flag — the global `jac` (from
8080
# `pip install jaclang`) builds its arg parser before the venv is on
8181
# the path, so it does not recognize `--scale`.
82-
.jac/venv/bin/jac start main.jac --scale
82+
#
83+
# Zero-touch retry for the RWO code-sync race (permanent fix tracked in
84+
# .github/CODE_SYNC_RWO_FIX.md). jac-scale syncs code via a throwaway
85+
# `jaseci-blogs-code-sync` pod that mounts the ReadWriteOnce (EBS) code
86+
# PVC. An EBS volume attaches to one node at a time, and the long-lived
87+
# code-server pod already holds it; if the scheduler places code-sync on
88+
# a DIFFERENT node it wedges in ContainerCreating (Multi-Attach) and the
89+
# deploy times out at "Syncing application code to PVC". Whether it
90+
# co-locates is scheduler luck — deploys pass for weeks, then fail with
91+
# no code change. So we retry: force-delete the wedged code-sync pod and
92+
# re-run, re-rolling the placement each time. The live app pod (which
93+
# serves from an emptyDir, not this PVC) is NEVER scaled or evicted, so
94+
# even a total failure leaves the site UP on the last-synced code
95+
# (identical to not deploying) — it never goes down.
96+
NS=jaseci-blogs
97+
for attempt in 1 2 3 4 5; do
98+
echo "::group::Deploy attempt ${attempt}/5"
99+
# Clear any code-sync pod wedged by this or a prior failed run, so
100+
# jac-scale can create a fresh one (avoids an AlreadyExists conflict).
101+
kubectl delete pod jaseci-blogs-code-sync -n "$NS" \
102+
--ignore-not-found --force --grace-period=0 2>/dev/null || true
103+
kubectl wait --for=delete pod/jaseci-blogs-code-sync -n "$NS" \
104+
--timeout=60s 2>/dev/null || true
105+
if .jac/venv/bin/jac start main.jac --scale; then
106+
echo "::endgroup::"
107+
echo "Deployed successfully on attempt ${attempt}."
108+
exit 0
109+
fi
110+
echo "::endgroup::"
111+
echo "Attempt ${attempt} failed (likely code-sync Multi-Attach on an off-node); retrying…"
112+
done
113+
echo "All 5 attempts failed. The live app pod was never touched, so the site"
114+
echo "is still serving the last successfully-synced code. Re-run this workflow —"
115+
echo "it usually succeeds once code-sync happens to co-schedule with the app pod."
116+
echo "For the permanent fix, see .github/CODE_SYNC_RWO_FIX.md."
117+
exit 1
83118
84119
- name: Verify deployment
85120
run: |

0 commit comments

Comments
 (0)