From 78403f6a44b8ad55bb0ee1b9f474c119619d7404 Mon Sep 17 00:00:00 2001 From: yukkop Date: Tue, 8 Sep 2026 08:59:03 +0000 Subject: [PATCH] ci: new workflow --- .gitea/workflows/runner-nix-smoke.yaml | 3 +++ docs/README.md | 7 +++++-- .../hectic/service/gitea-runner-controller.nix | 16 +++++++++++++++- nixos/system/hectic-lab/hectic-lab.nix | 2 ++ package/gitea-runner-controller/decide.sh | 8 -------- package/gitea-runner-controller/hcloud.sh | 13 +++++++++---- 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/runner-nix-smoke.yaml b/.gitea/workflows/runner-nix-smoke.yaml index 4016b15f..f6c224b6 100644 --- a/.gitea/workflows/runner-nix-smoke.yaml +++ b/.gitea/workflows/runner-nix-smoke.yaml @@ -16,6 +16,9 @@ jobs: name: nix label smoke runs-on: nix steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af6832 # v4.2.2 + - name: Nix version and cache configuration run: | set -eu diff --git a/docs/README.md b/docs/README.md index 30900f7b..ccbcfa8b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,8 +6,8 @@ Common labels for zero-idle runners: -- `ubuntu-latest` — default Ubuntu-style smoke / host runner path -- `nix` — Nix-capable runner path +- `ubuntu-latest` — persistent Ubuntu 24.04 `cx23` worker +- `nix` — persistent Nix-capable Ubuntu `cx23` worker - `gross-x86` — x86 fallback chain `cx53` / `cx43` / `cx33` - `gross-arm` — ARM fallback chain `cax41` / `cax31` / `cax21` - `gross-x86-perf` — x86 performance chain `cx53` / `cpx62` / `cpx52` @@ -19,5 +19,8 @@ Common labels for zero-idle runners: Region order for fallback: `nbg1`, then `fsn1`, then `hel1`. +`nix` and `ubuntu-latest` are persistent workers; only `gross-*` labels use +zero-idle ephemeral VMs. + Operational details: `infra/gitea-runners/runbook.md` and `package/gitea-runner-controller/decide.sh`. diff --git a/nixos/module/hectic/service/gitea-runner-controller.nix b/nixos/module/hectic/service/gitea-runner-controller.nix index 718ed9cd..23ec24e1 100644 --- a/nixos/module/hectic/service/gitea-runner-controller.nix +++ b/nixos/module/hectic/service/gitea-runner-controller.nix @@ -54,7 +54,9 @@ let "GCR_ACT_RUNNER_SHA256=${cfg.actRunnerSha256}" ] ++ lib.optionals (cfg.imageId != null) [ "GCR_IMAGE_ID=${cfg.imageId}" ] - ++ lib.optionals (cfg.armImageId != null) [ "GCR_ARM_IMAGE_ID=${cfg.armImageId}" ]; + ++ lib.optionals (cfg.armImageId != null) [ "GCR_ARM_IMAGE_ID=${cfg.armImageId}" ] + ++ lib.optionals (cfg.nixImageId != null) [ "GCR_NIX_IMAGE_ID=${cfg.nixImageId}" ] + ++ lib.optionals (cfg.armNixImageId != null) [ "GCR_ARM_NIX_IMAGE_ID=${cfg.armNixImageId}" ]; in { options = { @@ -129,6 +131,18 @@ in whose fallback chain includes ARM server types. ''; }; + nixImageId = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "161547269"; + description = "Hetzner Ubuntu image id used by Nix-capable x86 runners."; + }; + armNixImageId = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "161547270"; + description = "Hetzner Ubuntu image id used by Nix-capable ARM runners."; + }; actRunnerVersion = lib.mkOption { type = lib.types.str; default = "1.0.6"; diff --git a/nixos/system/hectic-lab/hectic-lab.nix b/nixos/system/hectic-lab/hectic-lab.nix index a9e2e976..6e4b5847 100644 --- a/nixos/system/hectic-lab/hectic-lab.nix +++ b/nixos/system/hectic-lab/hectic-lab.nix @@ -111,6 +111,8 @@ in { enable = true; imageId = "424558114"; # MicroOS x86 + Hetzner datasource dhcpcd fix armImageId = "423979717"; # OpenSUSE MicroOS ARM K3S 2026-08-24 snapshot + nixImageId = "161547269"; # Ubuntu 24.04 x86; Nix needs writable root + armNixImageId = "161547270"; # Ubuntu 24.04 ARM; Nix needs writable root allowedRepos = [ "hinterland/*" "yukkop/*" diff --git a/package/gitea-runner-controller/decide.sh b/package/gitea-runner-controller/decide.sh index bc2a228a..34c8ab74 100644 --- a/package/gitea-runner-controller/decide.sh +++ b/package/gitea-runner-controller/decide.sh @@ -22,8 +22,6 @@ gcr_server_hourly_rate() { gcr_label_ttl() { case "$1" in - ubuntu-latest) printf '60' ;; - nix) printf '180' ;; gross-x86) printf '180' ;; gross-arm) printf '180' ;; gross-x86-perf) printf '180' ;; @@ -40,12 +38,6 @@ gcr_label_ttl() { gcr_label_candidates() { label="$1" case "$label" in - ubuntu-latest) - printf '%s\n' 'cx33 nbg1 amd64' 'cx33 fsn1 amd64' 'cx33 hel1 amd64' - ;; - nix) - printf '%s\n' 'cx33 nbg1 amd64' 'cx33 fsn1 amd64' 'cx33 hel1 amd64' - ;; gross-x86) printf '%s\n' \ 'cx53 nbg1 amd64' 'cx53 fsn1 amd64' 'cx53 hel1 amd64' \ diff --git a/package/gitea-runner-controller/hcloud.sh b/package/gitea-runner-controller/hcloud.sh index d4bd0c70..edee4f4f 100644 --- a/package/gitea-runner-controller/hcloud.sh +++ b/package/gitea-runner-controller/hcloud.sh @@ -8,9 +8,14 @@ GCR_API="https://api.hetzner.cloud/v1" gcr_image_id_for_arch() { - case "$1" in - amd64) [ -n "${GCR_IMAGE_ID:-}" ] && printf '%s' "$GCR_IMAGE_ID" ;; - arm64) [ -n "${GCR_ARM_IMAGE_ID:-}" ] && printf '%s' "$GCR_ARM_IMAGE_ID" ;; + arch="$1"; label="${2:-}" + nix_image=0 + case "$label" in nix|gross-nix-*) nix_image=1 ;; esac + case "$arch:$nix_image" in + amd64:0) [ -n "${GCR_IMAGE_ID:-}" ] && printf '%s' "$GCR_IMAGE_ID" ;; + arm64:0) [ -n "${GCR_ARM_IMAGE_ID:-}" ] && printf '%s' "$GCR_ARM_IMAGE_ID" ;; + amd64:1) [ -n "${GCR_NIX_IMAGE_ID:-}" ] && printf '%s' "$GCR_NIX_IMAGE_ID" ;; + arm64:1) [ -n "${GCR_ARM_NIX_IMAGE_ID:-}" ] && printf '%s' "$GCR_ARM_NIX_IMAGE_ID" ;; *) return 1 ;; esac } @@ -168,7 +173,7 @@ gcr_vm_create() { while read -r candidate_type candidate_loc candidate_arch; do [ -n "${candidate_type:-}" ] || continue candidate_n=$((candidate_n + 1)) - image_id="$(gcr_image_id_for_arch "$candidate_arch")" || { + image_id="$(gcr_image_id_for_arch "$candidate_arch" "$label")" || { gcr_log warn --ns=hcloud "skip candidate[$candidate_n] label=$label arch=$candidate_arch no image" continue }