跳到主要内容

Gitea Runner 3.0.0 发布

· 阅读需 10 分钟
bircni
Technical Oversight Committee
本文由 AI 翻译,如有歧义请以 英文原文 为准。
Banner for blog post with title "Gitea Runner 3.0.0 发布"

我们很高兴宣布 Gitea Runner 3.0.0 发布。

这是 runner 侧的发布。它与现有 Gitea 版本保持协议兼容;主版本号提升反映的是三项破坏性变更,而非新的服务器依赖。

安全​

CVE-2026-73802:容器逃逸漏洞

当特权模式被禁用时,由工作流控制的容器选项现在会被清理,以防止容器逃逸攻击。runner 会剥离可用于突破容器隔离的选项(#1058):

PidMode,IpcMode,UTSMode,CgroupnsMode,UsernsMode,CapAdd,SecurityOpt,Devices,DeviceCgroupRules,DeviceRequests,VolumesFrom,Runtime,CgroupParent,以及 Sysctls。

当管理员明确启用特权模式时,这些选项会被保留,因为这已经表示接受扩大的宿主机访问权限。在非特权 runner 上依赖这些选项的工作流,必须在确实需要这些选项的 runner 上启用特权模式。

3.0.0 亮点​

本次发布的重点是 缓存服务 v2:标准 actions/upload-artifact、actions/download-artifact 和 actions/cache 现在无需 gitea-upload-artifact fork 即可配合 Gitea Runner 使用。除此之外,3.0.0 还新增了编码 secret 脱敏、任务钩子和代理传播,并增加了一项安全保护,防止两个守护进程共用同一个 runner 文件。

原版 artifact 与 cache actions——无需 fork​

Gitea Runner 现在与现有 v1 缓存 API 并列提供 GitHub Actions github.actions.results.api.v1.CacheService (v2),二者共用同一个存储,另外还提供 @actions/toolkit 上传器所使用的 Azure blob 协议子集 (#1110)。

实际上,这意味着未经修改的上游 actions 可以直接使用:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache
key: deps-${{ hashFiles('**/lockfile') }}
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

actions/upload-artifact / actions/download-artifact (v4.4.0 及更高版本) 和 actions/cache 不再需要 gitea-upload-artifact fork 或手工变通方案。runner 会在加载时修补 action 包,以打开 GHES 开关并从 ACTIONS_CACHE_URL 读取缓存端点;这一点已在涵盖 16 个 action 的 118 个真实包上得到验证。

信息

默认启用。 缓存服务 v2 由 runner 内置的缓存服务器通过 cache.v2 设置提供,并且也适用于 external_server 缓存配置。如果你当前部署了 gitea-upload-artifact fork,请参阅下方的“破坏性变更”说明。

编码 secret 脱敏​

以前只会对 secret 的原始值进行脱敏,因此如果某个 secret 通过一个对其进行序列化的 action 泄露,日志中仍会保持可读。现在,每个 secret 和 ::add-mask:: 值也会以其编码形式进行脱敏,与 GitHub runner 中的值编码器保持一致 (#1108):

  • JSON——通过 toJSON(secrets) 转义的值
  • Base64——例如通过 Authorization 头携带的 secret
  • URL 百分号编码——嵌入在 URL 中的 secret

不会改变值的编码会被跳过,因此一个普通令牌仍只需要一个替换对。

任务钩子​

运维人员现在可以在任务环境的两个生命周期节点运行宿主机脚本,对应 GitHub 的 ACTIONS_RUNNER_HOOK_JOB_STARTED / ACTIONS_RUNNER_HOOK_JOB_COMPLETED (#1111):

runner:
hooks:
job_started: /hooks/started.sh
job_completed: /hooks/completed.sh

job_started 在任务的第一步之前运行,job_completed 在最后一步之后运行。两者都会扫描各自输出中的工作流命令,读回 $GITHUB_ENV 和 $GITHUB_PATH,并在退出码非零时使任务失败。这对预热缓存、下发凭据或在每个任务前后发送遥测数据非常有用。

代理传播​

runner 现在会设置 http_proxy、https_proxy 和 no_proxy(小写和大写形式),以便它控制的所有内容都使用这些变量——任务、服务容器和 Dockerfile action 构建 (#1112)。

对于任务,合理的主机会自动被添加到 no_proxy:缓存服务器、回环地址、任务服务容器以及 Docker 守护进程(这样 docker-in-docker 仍能正常工作)。当你使用 dind 镜像时,该守护进程会读取相同的代理变量;如果 runner 在启动时检测到代理配置不一致,它会发出警告。

工具缓存重定位与挂载修复​

设置 RUNNER_TOOL_CACHE 现在会真正重定位工具缓存,而不只是修改变量,因此 ${{ runner.tool_cache }} 与环境变量会保持一致 (#1122)。同一变更还允许任务卷和服务卷替换同一目标位置上的冲突挂载,修复了 name:/target:ro 在字面路径 /target:ro 上被以读写方式挂载的问题,并使 config.yaml 中的未知键产生警告,而不是悄悄消失。

破坏性变更​

1. 缓存服务 v2 默认启用(#1110)。 runner 现在开箱即用地提供 v2 CacheService。如果你之前部署了 gitea-upload-artifact fork 或自定义的 artifact/cache shim,请将其移除,并将工作流切换到原生的 actions/upload-artifact@v4、actions/download-artifact@v4 和 actions/cache@v4。如果你必须保留之前的行为,请使用 cache.v2: false 禁用它。

2. 未启用特权模式时,主机逃逸容器选项将被移除(#1058)。 在 container.options 中设置诸如 PidMode、CapAdd、SecurityOpt、Devices 或 Sysctls 等选项的工作流,在非特权 runner 上将不再应用这些选项。如果工作流确实需要这些选项,请将其运行在管理员已明确启用特权模式的 runner 上——现在这个边界会被强制执行,而不是被悄悄绕过。

3. 每个 .runner 文件只允许一个 runner 进程(#1099)。 守护进程和 register 现在会在启动时对同级的 <runner-file>.lock 获取非阻塞建议锁。共享同一个 .runner 文件的两个进程之前会呈现相同的 UUID+令牌凭据,因此 Gitea 会把它们视为同一个 runner,导致它们互相取消对方的作业。同一主机上的第二个进程现在会快速失败,并给出清晰的报错。请为每个守护进程提供独立的 .runner 文件。操作系统会在退出时自动释放该锁,即使是被强制终止也是如此,因此不会积累残留锁。通过 NFS 共享 runner 文件的跨主机部署仍然依赖 Gitea 的服务端检测。

升级说明​

  • 在 Docker Compose、Kubernetes 清单和服务单元中,将 gitea/runner:2.x 替换为 gitea/runner:3.0.0。
  • 如果你使用了 gitea-upload-artifact 复刻或制品/缓存变通方案,请将其移除,并改用上游原版 actions(破坏性变更 1)。
  • 审计设置了 container.options 主机命名空间或设备标志的工作流;在确实需要这些标志的 runner 上启用特权模式(破坏性变更 2)。
  • 在推出前,确保每个 runner 守护进程都有自己的 .runner 文件(破坏性变更 3)。
  • 如果你在代理后面运行,请检查自动生成的 no_proxy 条目;对于 dind,请确认守护进程与 runner 的代理设置一致。
  • 在大范围推出之前,先在预发布环境中测试制品上传/下载、缓存恢复和取消操作。

下载​

预构建的二进制文件可从 Gitea Runner 下载页面 获取。

该发布也可从 Gitea Runner 发布页面 获取。

致谢​

感谢自 2.0.0 发布以来贡献代码、测试、错误报告、文档和反馈的每一个人。


以下 Changelog 保留英文原文,未作翻译,请与上游逐字核对。

Changelog​

3.0.0 - 2026-08-05​

  • BREAKING

    • Add cache service v2 next to the v1 cache API so stock actions/upload-artifact/download-artifact (v4.4.0+) and actions/cache work without the fork (#1110)
    • Strip host-escape container options (PidMode, CapAdd, SecurityOpt, Devices, Sysctls, …) when privileged mode is disabled (#1058)
    • Guard against two runner processes sharing one .runner file with an advisory lock (#1099)
  • FEATURES

    • Add job hooks runner.hooks.job_started / runner.hooks.job_completed (#1111)
    • Propagate http_proxy/https_proxy/no_proxy to jobs, services, and Dockerfile action builds (#1112)
    • Mask secrets that reach the log in JSON, base64, and URL-encoded forms (#1108)
  • BUGFIXES

    • Relocate the tool cache with RUNNER_TOOL_CACHE, allow mounting over runner paths, and warn on unknown config keys (#1122)
    • Stop leaking per-job docker networks (#1124)
    • Copy action directories into job containers when the target path is symlinked (e.g. /var/run → /run), including on Docker 29.7 (#1130, #1129)
    • Fix panics and enable the forcetypeassert lint (#1123)
    • Update github.com/ulikunitz/xz to v0.5.15 (security) (#1127)

2.3.0 - 2026-07-28​

  • FEATURES

    • Run pre-entrypoint and post-entrypoint of docker actions (#1106)
    • Report runner name, environment, workspace, and debug info to jobs (#1105)
    • Support --platform and --pull in container.options (#1104)
    • Read cache.external_secret from a file (#1100)
  • BUGFIXES

    • Escape command data the runner writes itself (#1120)
    • Clean up service containers after failed job setup (#1066)

2.2.0 - 2026-07-22​

  • FEATURES

    • Add runner health admission checks (#1090)
    • Report a GitHub-style "Set up job" section (#1089)
  • BUGFIXES

    • Repair the free-disk-space build on FreeBSD (#1098)
    • Stop host-mode jobs from leaking processes on Windows (#1080)
    • Classify a cancelled step as an interruption, not a failure (#1095)
    • Stop racing the daemon when removing containers (#1093)
    • Guard status-check functions against a nil job context (#1092)

2.1.0 - 2026-07-16​

  • FEATURES

    • Honor GITEA_RUNNER_LABELS on daemon start with colon-containing labels (#1085)
    • Add --token-file flag to the register command (#1076)
    • Add bug-report subcommand, exec --eventpath, and runner.set_act_env (#1075)
  • BUGFIXES

    • Ignore blank lines and decode UTF-16 in runner env files (#1084)
    • Prevent service containers from overwriting job container credentials (#1083)
    • Support natively typed boolean workflow inputs (#1087)
    • Remove action outputs exceeding size limits (#1070)

2.0.1 - 2026-07-09​

  • BUGFIXES
    • Skip service containers with an empty image (#1074)
    • Prevent exponential growth of RunContext masks in composite actions (#1059)
    • Attach task token when cloning actions from a self-hosted instance on a different host (#1056)
    • Install nftables in dind images to silence nft cleanup errors (#1064)