Commit 70ae188
refactor: extract rollback logic to rollback-stacks.sh (Phase 5)
Extract rollback and rollback health verification from inline heredocs to modular scripts:
Changes:
- Create scripts/deployment/rollback-stacks.sh (495 lines)
- Extracts rollback logic with stack discovery and parallel execution
- Validates previous SHA format before rollback attempt
- Dynamically discovers stacks from previous commit structure
- Implements parallel rollback with exit code file-based error detection
- Outputs discovered_rollback_stacks for health verification
- Uses ssh_retry for reliable remote execution
- Update "Rollback to Previous Version" step (line 594)
- Replace 430+ line heredoc with 19-line script call
- Pass all required parameters (SHA, timeouts, secrets)
- Capture and parse script output
- Update "Verify Rollback Health" step (line 622)
- Replace 205-line heredoc with 67-line call to health-check.sh
- Reuse existing health-check.sh for rollback verification
- Convert discovered stacks from null-delimited to space-delimited
- Add rollback_ prefix to outputs for workflow compatibility
Impact:
- Workflow reduced from 1,392 → 851 lines (39% reduction)
- Overall reduction from original: 2,548 → 851 lines (67% reduction)
- Eliminates duplicate health checking logic
- Improves maintainability with modular scripts
- Validates with actionlint (passes)
Phase 5 complete ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 7b3e28e commit 70ae188
File tree
2 files changed
+551
-587
lines changed- .github/workflows
- scripts/deployment
2 files changed
+551
-587
lines changed
0 commit comments