Files
JakeHillion 32f76316c6
commit-validation / validate-single-commit (pull_request) Successful in 6s
buildbot/nix-eval Build done. (521 warnings)
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
gitea-actions-vm-burst: fall back to Hetzner Cloud when GCP launches fail
The GCP project is limited to 2 concurrent burst VMs, so queued jobs
beyond that sit waiting even though the reconciler wants to launch
more. Hetzner Cloud is added as a fallback provider: each launch still
tries GCP first, and on any GCP failure creates a Hetzner server (type
cx43 by default) instead, trying every Hetzner location in random
order since capacity for shared-CPU types comes and goes per location.
maxInstances remains a single cap across both providers combined.

The runner image is uploaded once per image hash as a Hetzner snapshot
via hcloud-upload-image (raw + zstd, streamed onto a rescue-booted
temporary server), found again via a label carrying the image name.
The same #cloud-config user-data used locally and on GCE is passed as
Hetzner user_data and picked up by the native Hetzner datasource,
which is now allowed in the image's datasource_list. Hetzner has no
equivalent of GCE's --max-run-duration, so the reconciler enforces the
same age backstop itself, and powered-off servers (a runner VM powers
off after its single job, which still bills on Hetzner) are deleted on
each sweep. A snapshot lookup/upload failure only degrades Hetzner
launches rather than taking down GCP bursting.

Hetzner API tokens are scoped to a single Hetzner Cloud project, so
the token doubles as the isolation boundary: it must be created in a
dedicated project so the reconciler's cleanup sweep (which deletes
servers) cannot touch production machines. hcloud-token.age is a
placeholder encrypted to the master key (with a matching placeholder
rekeyed secret for boron) and must be replaced with a real token via
`agenix edit` + `agenix rekey` before Hetzner launches can work; until
then they fail with an auth error on each attempt and GCP behaviour is
unchanged.

Test plan:
- CI
- Built boron's toplevel locally (covers the Hetzner raw image
  conversion and the reconcile script's flake8 pass)
- After replacing the placeholder token and deploying: saturate GCP
  (>2 queued jobs) and verify overflow servers appear on Hetzner, run
  jobs, power off, and are deleted by the next sweep
2026-06-13 19:19:23 +01:00
..