panxiao81 b0b3a4b5a2
test / python (pull_request) Successful in 9s
test / shell (pull_request) Successful in 16s
修复 launcher 目录权限检查
2026-09-16 13:10:49 +00:00
2026-09-16 13:06:05 +00:00
2026-09-16 13:06:05 +00:00
2026-09-16 13:06:05 +00:00
2026-09-16 13:06:05 +00:00

Gitea microVM runner

为 Gitea Actions 按需启动 Cloud Hypervisor microVM。适合 kind、嵌套容器和其他不应 在常驻 Kubernetes runner 中执行的 CI 工作负载。

组件:

  • controller:接收 Gitea workflow_job webhook,将指定 label 的 queued job 发布到 NATS JetStream。
  • worker:在虚拟化宿主机领取任务,限制本机并发,并启动一次性 microVM。
  • microvm-runner-launch:为每个任务创建 COW disk、NoCloud seed 和 TAP,运行 Cloud Hypervisor,退出后完整清理。
  • guest-runner:在 guest 中领取一次性 runner registration token,注册 ephemeral runner,执行一个 job 后关机。

消息流使用一个 WorkQueuePolicy stream。相同 runner label 的所有 worker 共享同一 durable consumer;扩容只需要增加 worker 或提高单机 capacity。

开发

python -m venv .venv
. .venv/bin/activate
pip install -e '.[test]'
pytest

安全边界

  • NATS 密码、webhook secret 和 Gitea registration token 只从文件读取。
  • registration token 不写入 seed imageworker 通过单次 nonce endpoint 交给 guest。
  • guest runner 使用 --ephemeral,每台 VM 只执行一个 job。
  • launcher 只接受 UUID instance ID 和 URL-safe nonce,所有临时文件都位于独立目录。
  • base image 不得包含 runner identity、registration token、SSH 密码或 host key。

homelab 的 Kubernetes、OpenBao、LXC、bridge 和容量配置保留在 panxiao81/homelab-infra

按需启动 Cloud Hypervisor microVM 的 Gitea Actions runner autoscaler

S
Description
按需创建 Pod 与 Cloud Hypervisor microVM 的 Gitea Actions 动态 Runner
Readme
564 KiB
Languages
Go 64.5%
Python 30.1%
Shell 4.3%
Dockerfile 1.1%