Repository navigation
ci(test): make macOS k3s reliable by fixing the colima timeout budget - #2936
Conversation
The [k3s-macos] jobs cap "Start Docker-compatible runtime on macOS" at 45 minutes, but the setup-colima fallback ladder needs longer. It tries vz twice (each up to 480s start + 120s info + 600s k3s pull), so ~40 minutes goes to vz before qemu is attempted; the 45-minute cap then fires during the second vz retry and the qemu fallback (the runtime that actually comes up on the Intel runner) never runs. Every failure costs the full 45 minutes with zero helm tests executed. - Move `docker pull rancher/k3s:latest` out of the colima start/retry loop and pull it once after the runtime verifies. In the loop, a slow or rate-limited Docker Hub pull counted as a runtime-start failure and forced a full VM delete + rebuild, so registry flakiness masqueraded as hypervisor flakiness. It also shortens each start attempt by up to 600s. The ref still matches the emulator (pkg/emulator/driver/k3s.go). - Raise the colima step timeout from 45 to 60 minutes so the vz -> qemu fallback ladder can finish. CI-only; no product code changes.
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
…er fits its cap The 60-minute step cap still did not cover the worst-case ladder (brew installs, two vz attempts, two qemu attempts, teardowns, verify, pull: roughly 79 minutes of caps), and it equaled the job-level 60-minute budget, leaving no time for the k3s tests themselves. Shrink the ladder instead of growing the cap: - Go straight to qemu on x86_64: vz cannot come up on the Intel runners this job targets (the matrix uses macos-15-intel precisely because M-series runners lack the virtualization path), so the two vz attempts were ~27 minutes of guaranteed waste per failure. - Retry the relocated k3s pull (3 attempts): moving it out of the start loop removed its only retry, so one transient registry failure would have failed the job after a successful VM start. - Set the step cap to 35 minutes: a realistic qemu-only pass is 10-15 minutes, 35 gives 2x headroom, and the remaining job budget stays available for the tests.
…us propagation A green [k3s-macos] run (31723563772) shows vz starting on attempt 1 on macos-15-intel with the whole setup step under 6 minutes, and docs/fixes/2026-07-01-macos-k3s-runner-research.md records qemu failing there on usernet SSH forwarding before any test ran. So the previous commit had the ladder backwards: it forced qemu, the rung that never came up, on the runner where vz is the proven runtime. - Remove the uname -m selection, the qemu rung, and its brew install; keep two bounded vz attempts. - Fix failure propagation: status was captured after the completed if, which reads the if statement's own zero when no branch runs, so start_colima returned success after every attempt failed and the job died later at docker version with a misleading error. Capture in the else branch instead. - Keep diagnostics after both failures, bounded (colima status and limactl list capped at 30s); skip teardown and sleep after the final attempt since the runner is discarded anyway. - Pull: two independently retried 5-minute attempts. - Step cap 40 minutes, job cap stays 60. Every cap hit simultaneously sums to ~43m; 40 deliberately undercuts that, while a pass surviving one full attempt timeout plus a full retry plus one failed pull (~33m) still fits.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2936 +/- ##
=======================================
Coverage 82.98% 82.98%
=======================================
Files 1881 1881
Lines 183067 183067
=======================================
+ Hits 151925 151927 +2
- Misses 23317 23319 +2
+ Partials 7825 7821 -4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.226.0-rc.8. |
Why
[k3s-macos]is a required check (via[k3s] demo-helmfile) and flakes on unrelated PRs, costing the full step budget each time and blocking merge. The failure is entirely in CI setup: the job dies at "Start Docker-compatible runtime on macOS" without running a single helm test. Closes #2935.What
The colima setup ladder was longer than the step cap that contained it, so the step was guillotined before the ladder could finish, and a status-propagation bug hid which rung actually failed. This PR makes the ladder shorter than its cap instead of growing the cap:
docs/fixes/2026-07-01-macos-k3s-runner-research.mdalready selected vz formacos-15-inteland records qemu failing there onusernet unable to resolve IP for SSH forwardingbefore any test ran, and a green run (31723563772) confirms vz starting on attempt 1 with the whole setup step under 6 minutes. The qemu rung (plus its 7-minutebrew install qemucap) was a dead rung that only added minutes to the failure path. Two bounded vz attempts remain as the half-started-VM mitigation.start_colima.status=$?ran after the completedif, which reads theifstatement's own zero when no branch executes, so the function returned success after every attempt had failed and the job died later atdocker versionwith a misleading error. The status is now captured in theelsebranch.docker pull rancher/k3s:latestmoves out of the start/retry loop and retries on its own (two independent 5-minute attempts). In the loop, a slow or rate-limited Docker Hub pull counted as a runtime-start failure and forced a full VM delete + rebuild, so registry flakiness masqueraded as hypervisor flakiness.colima statusandlimactl listcapped at 30s so they cannot hang the step). Teardown and backoff run only between attempts; after the final failure the runner is discarded, so cleanup is dead time.Timeout arithmetic
Caps on the setup path: brew installs 7m + initial cleanup 1.5m + two vz start/info attempts 10m each + bounded diagnostics and intermediate cleanup ~3m + docker verify 1m + two 5-minute pull attempts with backoff. Every cap hit simultaneously sums to ~43 minutes; the 40-minute cap deliberately undercuts that. The recovery path fits when the final image pull completes normally; anything past 40 is treated as pathological. The observed healthy path is under 6 minutes.
Cost of merge
CI-only; no product code changes. The failure mode changes shape: instead of a slow crawl through a dead qemu rung, a runner where vz cannot start now fails hard after two bounded attempts, with diagnostics captured both times.
Out of scope (raised in #2935)
Pinning the k3s image would need a change to
pkg/emulator/driver/k3s.go(the ref is hardcoded there), so this PR keeps:latestto stay CI-only. Andmacos-15-intelis on GitHub's deprecation path; a longer-term plan for[k3s-macos]is noted in the issue.