|
| 1 | +# Flow CI/CD Runbook |
| 2 | + |
| 3 | +This runbook documents how Flow CI/CD is wired today and how to debug it quickly when jobs fail. |
| 4 | + |
| 5 | +## Architecture |
| 6 | + |
| 7 | +- Workflows: |
| 8 | + - `.github/workflows/canary.yml`: runs on every push to `main`, publishes/updates the `canary` release/tag. |
| 9 | + - `.github/workflows/release.yml`: runs on tag pushes matching `v*`, publishes stable releases. |
| 10 | +- Build jobs in both workflows: |
| 11 | + - Matrix build: macOS + Linux targets. |
| 12 | + - SIMD build: `build-linux-host-simd` (Linux x64 with `--features linux-host-simd-json`). |
| 13 | +- Release jobs: |
| 14 | + - Gather all build artifacts. |
| 15 | + - Publish release assets (and in Canary, force-move `canary` tag to current `main` commit). |
| 16 | + |
| 17 | +## Runner Modes |
| 18 | + |
| 19 | +Flow uses task-driven mode switching (not manual workflow edits): |
| 20 | + |
| 21 | +- `github` mode: |
| 22 | + - Standard Linux lanes on `ubuntu-latest`. |
| 23 | + - SIMD lane disabled. |
| 24 | +- `blacksmith` mode: |
| 25 | + - Linux lanes on Blacksmith runners. |
| 26 | + - SIMD lane enabled on Blacksmith. |
| 27 | +- `host` mode: |
| 28 | + - Standard Linux lanes stay on GitHub-hosted runners. |
| 29 | + - SIMD lane runs on self-hosted label: `[self-hosted, linux, x64, ci-1focus]`. |
| 30 | + |
| 31 | +Check/switch mode: |
| 32 | + |
| 33 | +```bash |
| 34 | +f ci-blacksmith-status |
| 35 | +f ci-blacksmith-enable |
| 36 | +f ci-blacksmith-enable-apply |
| 37 | +f ci-host-enable |
| 38 | +f ci-host-enable-apply |
| 39 | +f ci-blacksmith-disable |
| 40 | +f ci-blacksmith-disable-apply |
| 41 | +``` |
| 42 | + |
| 43 | +## One-Command Host Setup |
| 44 | + |
| 45 | +Preferred path (painless, idempotent): |
| 46 | + |
| 47 | +```bash |
| 48 | +f ci-host-setup |
| 49 | +``` |
| 50 | + |
| 51 | +If infra host is not configured yet: |
| 52 | + |
| 53 | +```bash |
| 54 | +f ci-host-setup <user@ip> |
| 55 | +``` |
| 56 | + |
| 57 | +What `f ci-host-setup` does: |
| 58 | + |
| 59 | +1. Validates `gh` auth and `infra` host config. |
| 60 | +2. Installs/registers the `ci-1focus` self-hosted runner on the Linux host. |
| 61 | +3. Waits for runner to report online. |
| 62 | +4. Switches workflows to `host` mode with commit + push. |
| 63 | +5. Prints final runner health/status. |
| 64 | + |
| 65 | +## Daily Operations |
| 66 | + |
| 67 | +- Check current mode: `f ci-blacksmith-status` |
| 68 | +- Check runner service + GitHub registration: `f ci-host-runner-status` |
| 69 | +- Reinstall runner if needed: `f ci-host-runner-install` |
| 70 | +- Remove runner: `f ci-host-runner-remove` |
| 71 | + |
| 72 | +Stable release flow: |
| 73 | + |
| 74 | +1. Merge version bump to `main`. |
| 75 | +2. Push tag `vX.Y.Z`. |
| 76 | +3. Watch `Release` workflow. |
| 77 | + |
| 78 | +Canary flow: |
| 79 | + |
| 80 | +1. Push to `main`. |
| 81 | +2. Watch `Canary` workflow. |
| 82 | +3. Confirm `canary` tag moved and release assets updated. |
| 83 | + |
| 84 | +## Debug Playbook |
| 85 | + |
| 86 | +### 1) Workflow failed or stuck |
| 87 | + |
| 88 | +```bash |
| 89 | +gh run list --workflow Canary --limit 10 |
| 90 | +gh run list --workflow Release --limit 10 |
| 91 | +gh run view <run-id> --log-failed |
| 92 | +gh run watch <run-id> |
| 93 | +``` |
| 94 | + |
| 95 | +### 2) SIMD lane queued forever |
| 96 | + |
| 97 | +Usually means self-hosted runner routing issue. |
| 98 | + |
| 99 | +```bash |
| 100 | +f ci-blacksmith-status |
| 101 | +f ci-host-runner-status |
| 102 | +python3 ./scripts/ci_host_runner.py health --repo nikivdev/flow |
| 103 | +``` |
| 104 | + |
| 105 | +Expected healthy state is: |
| 106 | + |
| 107 | +- Host service: `active` |
| 108 | +- GitHub runner status: `online` |
| 109 | +- Runner has label `ci-1focus` |
| 110 | + |
| 111 | +If not healthy, run: |
| 112 | + |
| 113 | +```bash |
| 114 | +f ci-host-runner-install |
| 115 | +python3 ./scripts/ci_host_runner.py wait-online --repo nikivdev/flow --timeout-secs 120 --interval-secs 5 |
| 116 | +``` |
| 117 | + |
| 118 | +### 3) Workflows not using expected runner profile |
| 119 | + |
| 120 | +```bash |
| 121 | +f ci-blacksmith-status |
| 122 | +``` |
| 123 | + |
| 124 | +If wrong: |
| 125 | + |
| 126 | +```bash |
| 127 | +f ci-host-enable-apply |
| 128 | +# or: |
| 129 | +f ci-blacksmith-enable-apply |
| 130 | +# or: |
| 131 | +f ci-blacksmith-disable-apply |
| 132 | +``` |
| 133 | + |
| 134 | +### 4) `curl ... install.sh` does not fetch expected fresh build |
| 135 | + |
| 136 | +Flow installer defaults to `canary` unless `FLOW_VERSION` is set differently. Check if `canary` moved: |
| 137 | + |
| 138 | +```bash |
| 139 | +git ls-remote --tags origin canary |
| 140 | +``` |
| 141 | + |
| 142 | +Then verify in sandbox (recommended) using: |
| 143 | + |
| 144 | +- `docs/rise-sandbox-feature-test-runbook.md` |
| 145 | + |
| 146 | +That runbook gives an isolated `rise sandbox` smoke test for: |
| 147 | + |
| 148 | +```bash |
| 149 | +curl -fsSL https://myflow.sh/install.sh | sh |
| 150 | +~/.flow/bin/f --version |
| 151 | +``` |
| 152 | + |
| 153 | +### 5) Setup task fails mid-install |
| 154 | + |
| 155 | +Re-run: |
| 156 | + |
| 157 | +```bash |
| 158 | +f ci-host-setup |
| 159 | +``` |
| 160 | + |
| 161 | +The installer path is idempotent (it removes old service/config before re-registering). If failure persists, inspect: |
| 162 | + |
| 163 | +```bash |
| 164 | +f ci-host-runner-status |
| 165 | +gh api repos/nikivdev/flow/actions/runners |
| 166 | +``` |
| 167 | + |
| 168 | +## Notes |
| 169 | + |
| 170 | +- CI/CD execution is defined in repo workflows; GitHub UI is control plane/visibility (runs, logs, runner state), not the source of truth for pipeline logic. |
| 171 | +- Current performance balance: keep general Linux matrix jobs on GitHub-hosted runners, offload expensive SIMD build to the Linux host. |
0 commit comments