Prhub

#44463 [CI] Resolve release V2 docker build after ROCm CI wheels change

原始 PR 作者 AndreasKaratzas 合并时间 2026-06-04 12:35 文件变更 2 提交数 1 评论 0 代码增减 +8 / -2

执行摘要

修复 release docker 构建因为 dirty repo 失败

Release Docker 构建在 ROCm CI wheels 变更后失败,错误信息为 Repo is dirty。根本原因是 .dockerignore 排除了 .clang-format.gitattributes 等追踪文件,容器内工作树缺少这些文件,而 Git 干净性检查仍会检查它们,导致不一致。修复通过恢复这些文件来保持一致,同时保持 Docker 上下文精简。

该 PR 值得快速合并,修复了明确的 CI 阻塞问题。后续可考虑更通用方案(如统一在容器内重新 checkout 而非手动恢复特定文件列表),但当前方案已足够。

讨论亮点

无 review 评论。

实现拆解

  1. 修改 .dockerignore:移除排除 .clang-format.gitattributes 的行,使这两个文件重新包含在 Docker 上下文中。其他非构建路径如 docs/.github/.pre-commit-config.yamlformat.sh 仍被忽略。
  2. 增强 tools/check_repo.sh:在脚本开头检测 Docker 环境(/.dockerenv 文件存在),如果是,则使用 git checkout-index 从 Git 索引中恢复被 .dockerignore 排除的追踪文件(docs.github.pre-commit-config.yamlformat.sh),然后再执行 git diff --quiet 检查干净性。这样即使 Docker 上下文中缺少这些文件,也能恢复它们,避免假阳性 dirty 错误。
文件 模块 状态 重要度
.dockerignore 构建脚本 modified 2.94
tools/check_repo.sh 构建脚本 modified 3.89

关键源码片段

tools/check_repo.sh core-logic

添加 Docker 环境下恢复被忽略追踪文件的逻辑,确保 git diff --quiet 能正确判断仓库干净性。

#!/bin/bash
# Checks whether the repo is clean and whether tags are available (necessary to correctly produce vllm version at build time)# Some Docker builds intentionally omit tracked, non-build files from the
# context. Restore only those paths from the mounted .git object database before
# checking cleanliness so release builds still see a coherent worktree.
if [ -f /.dockerenv ]; then
    # 使用 git ls-files 列出被 .dockerignore 排除的追踪文件路径
    # 然后通过 git checkout-index 从 Git 索引还原到工作树
    git ls-files -z -- docs .github .pre-commit-config.yaml format.sh \
    | git checkout-index -f -z --stdin
fiif ! git diff --quiet; then
    echo "Repo is dirty" >&2
    exit 1
fi

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

风险很低。变更仅影响 Docker 构建流程和 .dockerignore,且已通过 git diff --checkbash -n tools/check_repo.sh 和临时工作树模拟验证。恢复文件的逻辑仅限 Docker 环境,不影响常规构建。

影响范围小,仅限 release Docker 构建流程。修复后这些构建不再因文件缺失而失败,其他自动化流程(如 CI 基础构建)不受影响。团队无需额外操作。

仅影响 Docker 构建流程

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论