fix(ci): preflight self-hosted runner prerequisites#1339
Merged
Conversation
ZR233
marked this pull request as ready for review
June 22, 2026 03:00
ZR233
force-pushed
the
codex/ci-self-hosted-preflight
branch
from
June 22, 2026 03:03
1aea8d8 to
0896f7e
Compare
Contributor
There was a problem hiding this comment.
PR 审查总结
变更内容
本 PR 在 .github/workflows/reusable-command.yml 的 run_host 任务中新增了 self-hosted runner preflight 检查步骤,并在 .github/workflows/ci.yml 中为需要 KVM 的 x86_64 VMX/UEFI/axloader 矩阵项设置 require_kvm: true。
具体变更:
- 新增
require_kvmworkflow_call 输入(boolean,默认 false) - 新增 Preflight 步骤:仅在
runs_on包含self-hosted时执行- 检查
rustc、cargo是否在 PATH 中可见,输出版本信息 - 输出 runner 名称、OS/arch、用户和组信息
- 当
require_kvm=true时检查/dev/kvm存在性和读写权限 - 输出 KVM 模块信息和 CPU vendor
- 失败时通过
::error::和 step summary 明确报告
- 检查
ci.yml中仅对self-hosted/linux/intel/kvm的 x86_64 项设置require_kvm: true
实现逻辑
实现正确且符合项目需求:
- Preflight 正确放置在
run_host任务中(run_container不需要,因为容器镜像已预装工具) - KVM 检查仅在明确需要的矩阵项上启用,避免误报
set -euo pipefail保证脚本健壮性record_error函数收集所有错误后统一退出,而非遇到第一个错误就停止lsmod未找到 KVM 模块时仅发出 warning(合理,因为 KVM 可能是内建模块)
CI 状态
- Push 事件 run #6857:success ✓
- PR 事件 run #6858:所有矩阵项为 skipped(因为本 PR 仅修改 workflow 文件,路径过滤导致测试矩阵被跳过)。这是预期行为,不属于 PR 导致的 CI 失败。
本地验证
- Shell 语法检查:
bash -n通过 ✓ - PR 正文声明的
actionlint和bash -n验证已由作者完成 - 本 PR 仅修改 YAML workflow 文件,无需 Rust 编译/测试验证
重复/重叠分析
搜索了当前 open PRs(#1340 ax-net 重构、#1336 sdio-host、#1333 image 工具),均与本 PR 完全无关。本 PR 解决的 CI preflight 问题 (#813) 没有其他 PR 在处理。
历史评论
无先前 review 评论或 issue 评论需要处理。
结论
本 PR 质量良好,正确解决了 #813 中描述的 self-hosted runner 环境不满足前置条件的问题。代码简洁、作用域恰当、验证充分。建议合并。
Powered by mimo-v2.5-pro
Merged
Antareske
pushed a commit
to Antareske/tgoskits
that referenced
this pull request
Jun 27, 2026
Antareske
pushed a commit
to Antareske/tgoskits
that referenced
this pull request
Jun 27, 2026
luodeb
pushed a commit
that referenced
this pull request
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
#813 记录了 self-hosted
run_host类 CI 在正式测试前因为 runner 基础环境不满足约定而失败的问题:有些 runner 缺少rustc/cargo,有些标记为intel,kvm的 runner 没有可用/dev/kvm或权限不正确。失败原本会晚到 QEMU 或测试命令内部才暴露,日志不够直接。修改
.github/workflows/reusable-command.yml的 host 执行路径新增 self-hosted preflight:runs_on包含self-hosted时执行;rustc、cargo是否在 GitHub Actions service 的PATH中可见,并输出rustc -vV、cargo -V;require_kvmworkflow_call 输入,用于需要 KVM 的 self-hosted job:/dev/kvm是否存在且对 runner 用户可读写;/dev/kvm权限、KVM 模块线索和 CPU vendor/implementer;::error::和 step summary 明确指出前置条件问题。ci.yml中只给self-hosted/linux/intel/kvm的 x86_64 VMX/UEFI/axloader 项设置require_kvm: true,避免普通 self-hosted/board 任务误要求 KVM。fail-fast行为不变,使前置条件失败仍能快速停止相关矩阵,避免浪费 CI 资源。验证
python3解析.github/workflows/ci.yml和.github/workflows/reusable-command.yml成功。bash -n /tmp/self-hosted-preflight.shREQUIRE_KVM=false本地 dry run 通过。REQUIRE_KVM=true本地 dry run 通过,并确认/dev/kvm可用。/tmp/actionlint/actionlint -ignore 'unexpected key "queue"' .github/workflows/ci.yml .github/workflows/reusable-command.yml通过。concurrency.queue: max对当前 actionlint 版本的报错,不是本 PR 新增内容。git diff --check通过。Fixes #813