Pull Request已成功合入, 合并人@ascend-robot
(感谢 wangqi 的贡献)变更摘要
该 PR 为 v2.9.0 分支新增了 .github/workflows/build-docker-images.yml 工作流文件,实现了 CI Docker 镜像的自动化构建与推送流程。工作流支持 workflow_dispatch 手动触发(可指定单个镜像 tag)以及 .ci/docker/** 路径变更时的 push 自动触发;涵盖 8 个预定义镜像(builder 与 test 各两个架构、test 覆盖 CANN A1/A2/A3),统一推送至华为云 SWR 镜像仓库,tag 附带 UTC 时间戳,并自动生成构建汇总报告。
主要改动
- 新增完整 CI 工作流文件:添加
.github/workflows/build-docker-images.yml,定义matrix、build、summary三个 job,形成从标签矩阵生成、镜像构建推送到结果汇总的完整流水线。 - 双触发机制:
workflow_dispatch支持手动运行并可选择性地仅构建单个镜像 tag;push触发器监听.ci/docker/**及该工作流文件自身的变更,实现自动化构建。 - 矩阵策略与 runner 自适应:
matrixjob 输出 8 个预定义镜像 tag(覆盖x86_64/aarch64架构及 CANN A1/A2/A3 变体),buildjob 通过contains(matrix.tag, 'x86_64')表达式自动选择ubuntu-latest或ubuntu-22.04-armrunner。 - 镜像构建与推送流程:通过
docker/login-action@v3登录 SWR 镜像仓库后,调用.ci/docker/docker_build.sh构建镜像,并为每个镜像附加 UTC 时间戳 tag(格式YYYYMMDDHHMM),最终docker push至swr.cn-north-4.myhuaweicloud.com/frameworkptadapter/pytorch。 - 构建结果汇总:
buildjob 将每个镜像的完整远程地址写入 artifact,summaryjob 收集所有结果后生成 Markdown 格式的汇总表格输出至$GITHUB_STEP_SUMMARY,便于快速查看所有已推送的镜像及拉取命令。


代码审查
审查总结
对 .github/workflows/build-docker-images.yml 进行了全面审查,覆盖以下维度:
| 维度 | 结论 |
|---|---|
| YAML key 拼写 | ✅ 全部正确 |
runs-on 表达式 (L43) |
✅ contains + &&/` |
docker_build.sh 调用 (L69) |
✅ TIMESTAMP 传递一致,参数正确 |
inputs.tag 注入 (L28-29) |
✅ workflow_dispatch 需 write 权限,不构成权限提升;docker_build.sh 有 case 白名单兜底 |
| 磁盘清理 (L45-52) | ✅ 激进但合理,后续步骤仅依赖 Docker 和 Node.js |
| 镜像构建/推送流程 (L64-77) | ✅ 逻辑正确,失败时不会写入结果文件 |
| Upload artifact (L79-85) | ✅ if: always() + retention-days: 1 合理 |
| Summary job (L87-118) | ⚠️ 见下方发现 |
发现统计
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
整体风险判断
低风险。该工作流整体设计合理,仅在 summary job 的错误处理上存在一处中等问题:当所有构建失败导致无 artifact 时,"No images built" 兜底摘要无法输出,用户无法从 Summary 页面获知运行结果。修复方式简单(添加一行 if: always()),不影响其他逻辑。除此之外,该工作流可安全合入。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 0 |
| 🟡 建议 | 1 |
💬 仅评论


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ 吴环宇, huangjingwei (2/2) | ✅ 吴环宇 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wangqi0808, thanks for your pull request. All authors of the commits have signed the CLA. 👍


当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.10.0 | ||
| v2.7.1-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| v2.7.1 | ||
| v2.9.0 | ||
| v2.12.0 | ||
| v2.11.0-26.1.0 | ||
| v2.11.0 | ||
| v2.10.0-26.1.0 | ||
| v2.9.0-26.1.0 | ||
| ci-test |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| CodeCheck_lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_ARM_A3_Part_01 | 🛑 | >>> |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


🟡 Medium Priority
变更行:第 99-118 行的 Generate summary 步骤,该步骤未设置 if: 条件,默认 if: success()。
影响行为/契约:summary job 本身已设置 if: always()(第 90 行),但 job 内部步骤默认遵循 if: success()。当前置步骤 Download results(第 92-97 行)因没有任何 artifact 而失败时(例如:所有 build 均失败导致无 artifact 上传,或 matrix job 失败导致 build 被跳过),Generate summary 步骤会被跳过。
失败模式:本工作流特意在第 113-114 行编写了 "No images built" 的兜底摘要输出,但由于上述原因,该兜底代码在所有构建失败时反而永远不会被执行——用户看不到任何 Summary,也无法从 Summary 页面获知本次运行"没有镜像被构建"。这与设计意图(需要统一的发布入口和结果追溯)矛盾。
建议:为 Generate summary 步骤添加 if: always(),确保即使 Download results 失败,也能输出 "No images built" 兜底摘要。同时建议为 Download results 步骤添加 continue-on-error: true。


/lgtm


/approve


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.




Summary
为 v2.9.0 分支添加
.github/workflows/build-docker-images.yml,实现 CI Docker 镜像的自动构建与推送到 SWR 镜像仓库。Related: #3073
Changes
.github/workflows/build-docker-images.ymlworkflow_dispatch手动触发和push自动触发(.ci/docker/**变更时)swr.cn-north-4.myhuaweicloud.com/frameworkptadapter/pytorch,Tag 含 UTC 时间戳ubuntu-latest,aarch64 →ubuntu-22.04-arm