跳到主要内容

Gitea Runner 2.0.0 正式发布

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

我们很高兴宣布 Gitea Runner 2.0.0 正式发布。

此版本带来了作业摘要、改进的取消处理、先前被忽略的作业级工作流语法,以及自 1.0.0 稳定版以来的大量可靠性修复。

2.0.0 中的几项主要功能需要与服务器端的 Gitea 1.27 配合使用。Runner 仍与旧版 Gitea 保持线路兼容;若服务器未通告某项能力,Runner 会直接跳过相关功能。

2.0.0 中的亮点

作业摘要

工作流步骤现在可以向 GITHUB_STEP_SUMMARY 写入内容,当 Gitea 声明支持时,runner 会上传渲染后的 markdown。摘要会与作业日志一同显示在 Actions 运行视图中。

信息

需要 Gitea 1.27 才能存储和显示摘要。对于较旧的 Gitea 版本,当服务器未声明 job-summary 能力时,runner 会跳过上传。

取消与清理

取消处理得到了大幅改进:

  • runner 声明 cancelling 能力,使 Gitea 能够在作业最终被标记为取消之前使用过渡性的 Cancelling 状态。
  • 现在,取消时也会运行后置步骤以及 if: always() / if: cancelled() 主要步骤,与 GitHub Actions 行为一致。
  • 当作业被取消时,Unix 和 Windows 的步骤进程树会被可靠地终止,避免 runner 卡住。
信息

需要 Gitea 1.27 才能获得过渡性的 Cancelling 作业状态和协商能力。runner 在通信层面仍可与旧版服务器兼容;没有 Gitea 1.27 时,取消功能仍然可用,但缺少完整的服务端语义。

作业级工作流语法

两个从 YAML 解析出来但一直静默忽略的 jobs.<job_id> 字段现已实现:

  • timeout-minutes — 为整个作业(容器启动、前置步骤、主要步骤和后置步骤)设置一个截止时间。支持表达式插值。仅 runner 需要,无需升级 Gitea。
  • continue-on-error — 当作业允许失败时,依赖 if: success() 的后续作业仍会运行,与 GitHub Actions 语义一致。
信息

需要 Gitea 1.27 才能在进行工作流运行聚合时,将容忍的作业失败视为 needs 成功。

任务后主机钩子

新增一个可选的 runner.post_task_script 设置,它会在每个任务的内置清理过程(后置步骤、容器拆除、绑定工作目录移除)之后执行一个主机可执行文件。这对于在各作业之间修剪 Docker 镜像、清理临时磁盘或重置虚拟机状态非常有用。有关生命周期细节和超时行为,请参阅任务后脚本文档

其他 runner 功能

  • ssh:// action URL — 除 HTTPS 和 HTTP 外,现在也可以通过 SSH 克隆 action。
  • 浅克隆 action — 远程 action 默认浅克隆(runner.action_shallow_clone,默认 true),并在需要时自动回退到完整克隆。
  • IPv6 容器网络container.options.network.enable_ipv6 控制作业禁用网络创建时的 IPv6。
  • 作业容器卷插值container.volumes 条目现在支持表达式插值。

破坏性变更

Docker 拉取凭证: Gitea Runner 不再隐式将 DOCKER_USERNAMEDOCKER_PASSWORD 工作流 secrets 用于镜像拉取(#1007)。这些名称通常被用于镜像推送时的注册表登录,将它们发送给每一次拉取会导致针对 Docker Hub 的认证失败。

如果你此前依赖旧的隐式行为,请迁移到显式凭证:

jobs:
build:
container:
image: registry.example.com/image:tag
credentials:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

对于私有 Docker 动作或服务容器,请在服务定义上使用 credentials,或在作业开始前在 Runner 主机上运行 docker login

升级说明

  • 在 Docker Compose、Kubernetes 清单和服务单元中,将 gitea/runner:1.0.x(或更旧的标签)替换为 gitea/runner:2.0.0
  • 审查对拉取操作使用 DOCKER_USERNAME / DOCKER_PASSWORD 的工作流(参见上文的破坏性变更)。
  • 如果你在作业级别使用 continue-on-error,请将 Gitea 升级到 1.27,以便工作流结果体现预期的语义。
  • 在广泛部署前,请先在预发布环境中测试工作流取消和 always() 清理步骤。

下载

预编译的二进制文件可以从 Gitea Runner 下载页面 获取。

该版本也可在 Gitea Runner 发布页面 找到。

感谢

感谢自 1.0.0 版本发布以来,所有通过代码、测试、Bug 报告、文档和反馈做出贡献的各位。


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

Changelog

2.0.0 - 2026-06-30

  • BREAKING

    • Stop implicitly using DOCKER_USERNAME/DOCKER_PASSWORD secrets for image pulls (#1007)
  • FEATURES

    • Upload job summary when Gitea advertises support — requires Gitea 1.27 (#917)
    • Complete runner-side cancellation handling — pairs with Gitea 1.27 (#1016)
    • Enable jobs.<job_id>.timeout-minutes (#1032)
    • Enable jobs.<job_id>.continue-on-errorrequires Gitea 1.27 for workflow aggregation (#1032)
    • Add optional runner.post_task_script hook after task cleanup (#1026)
    • Support ssh:// action URLs (#1035)
    • Shallow clone action repositories by default (#1053)
    • IPv6 options for network container creation (#1029)
  • BUGFIXES

    • Run always()/cancelled() and post steps correctly on cancellation (#1043)
    • Kill Unix step process group on cancel to avoid hang (#1025)
    • Composite nested uses: actions use the clone token (#1041)
    • Namespace local docker action image tags per repository (#1051)
    • Interpolate job container.volumes (#1036)
    • Prevent loss of step log output at end of step (#1028)
    • Bound host-environment cleanup and reclaim leaked scratch dirs (#1024)
    • Guard SetJobError against missing job-error container (#1050)
    • Do not update cached actions with stale origin URL (#1014)

1.0.8 - 2026-06-02

  • BUGFIXES
    • Kill Windows step process tree on cancel to avoid hang (#1011)

1.0.7 - 2026-05-29

  • BUGFIXES
    • Re-validate cached container id before reuse (#1003)
    • Support multiline secret masking (#1001)
    • Fix matrix-job data races and outputs (#994)
    • Deliver cancel ack and reap leftover Windows job processes (#996)
    • Respect configured log level for job log forwarding (#989)

1.0.6 - 2026-05-22

  • BUGFIXES
    • Clean up job network and container when container start fails (#986)

1.0.5 - 2026-05-21

  • FEATURES

    • Add cache.offline_mode to reuse cached actions without fetching (#966)
  • BUGFIXES

    • Remove stale Gitea 1.20 compatibility shims (#978)

1.0.4 - 2026-05-18

  • FEATURES

    • Make pseudo-TTY allocation opt-in (#961)
  • BUGFIXES

    • Fix token use with schemaless Gitea instance (#977)
    • Fix host cleanup, volume allowlist, cache upload, and action host edge cases (#970)
    • Support env-file lines larger than 64 KiB (#974)
    • Respect proxy env vars in runner client (#962)
    • Return early when parallel executor length is zero (#960)
    • Switch Docker dependencies to moby/moby (#943)
  • ENHANCEMENTS

    • Add OCI source and version labels to images (#975)

1.0.3 - 2026-05-12

  • BUGFIXES
    • Isolate per-task runner envs (#959)
    • Ensure dbfs_data is cleaned up after task completion (#952)
    • Preserve cache key case to stop redundant uploads (#947)

1.0.2 - 2026-05-08

  • FEATURES

    • Remove emojis from runner logging; add Starting job container log group (#940)
  • BUGFIXES

    • Overwrite read-only files when copying action directories (#942)
    • Serialize action-cache reads to prevent worktree race (#938)
    • Add apparmor=rootlesskit in security_opt (#937)

1.0.1 - 2026-05-07

  • BUGFIXES
    • Re-fetch cached reusable workflow on every run (#930)