已合并
[feature]:devcontainer机制打样仓合入 #61
孟广欣创建于 7月22日
[feature]:devcontainer机制打样仓合入 #61
已合并
孟广欣创建于 7月22日
孟广欣
孟广欣成员
7月22日

1. 修改描述

  • 修改原因: 产品线统一要求上线devcontainer功能
  • 修改方案: 按要求上线devcontainer功能
  • 修改内容: 增加devcontainer需求相关功能

2. 功能验证


3. 代码检视

  • 要求:
    • 合入功能代码大于 200 行,需要sig会议申报代码检视议题,并在PR中标注会议。
    • committer评估是否需要在sig会议进行代码检视。
    • 参与检视的committer人员名单与检视时间。
    • 大于 1000 行代码原则上不允许合入,需进行备案。
  • 检视committer人员名单与检视时间:

4. 资料修改自检

  • 资料修改: NA

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 孟广欣 的贡献)
atomgit-bot
atomgit-bot
7月22日 评论:

变更摘要

此次 PR 主要为 MindStudio 项目引入了完整的 Dev Container 开发环境机制,并新增了 VS Code 工作区配置与调试模板。核心变化包括:通过 devcontainer.json 定义一致的容器化开发环境(镜像、挂载、运行参数、环境变量),通过 initialize.sh 在宿主机侧完成镜像拉取与 Git 配置快照准备,通过 post-create.sh 在容器内自动完成用户环境初始化(Python 版本切换、Git 身份同步、pre-commit hook 安装、缓存权限修复等),同时新增 git-safe-pull.sh 以安全处理 skip-worktree 标记文件的拉取操作。此外在 build.py 中新增了 only_down_deps 参数支持,允许仅下载依赖后提前退出构建流程。

主要改动

  • Dev Container 环境定义:新增 .devcontainer/devcontainer.json,指定了容器镜像 swr.cn-north-4.myhuaweicloud.com/mindstudio-image/mindstudio-build:26.1.0-0701--privileged--network=host 等运行参数、GCC11_NO_RPATH / UV_CACHE_DIR / NPM_CONFIG_PREFIX 等环境变量,以及 VS Code 扩展与终端设置。
  • 宿主机初始化脚本:新增 .devcontainer/initialize.sh,在容器创建前使用 Python 解析 devcontainer.json 中的镜像名并执行 docker pull,同时生成宿主 .gitconfig 快照和创建 uv 缓存目录。
  • 容器内环境自动化配置:新增 .devcontainer/post-create.sh(518 行),按依赖顺序执行 fix_cache_ownershipconfigure_user_binconfigure_python311sync_git_identityinstall_pre_commit_hookignore_vscode_settingsinstall_git_safe_pull_alias 等 10 个模块,每个模块自行降级处理失败场景。
  • skip-worktree 安全拉取:新增 .devcontainer/git-safe-pull.sh,通过 git update-index 临时取消 skip-worktree 标记、stash 本地修改、执行 git pull 并在成功后丢弃 stash 的流程,与 ignore_vscode_settings 配合使用以避免 .vscode/settings.json 本地修改造成的拉取冲突。
  • 构建脚本扩展:在 build.pyBuildManager 中新增 extra_options 字典解析,当 --extra only_down_deps=true 时跳过后续编译或测试流程,仅完成依赖下载后返回。
likedislike
atomgit-bot
atomgit-bot
7月22日 评论:

代码审查

All files reviewed. Let me now provide the closing summary.


审查总结

本次审查覆盖了全部 10 个变更文件,共发现 6 个问题

优先级 数量 文件
P1 1 .devcontainer/post-create.sh — 缺失 fix_file_watcher_limit 函数定义
P2 1 .devcontainer/git-safe-pull.shgit stash push 无修改时触发 set -e 静默跳过 pull
P3 4 .devcontainer/README.md(SSH 空 passphrase、任务名不一致×2)、build.pyonly_down_deps 日志误导)

各文件审查结论

文件 结论
.devcontainer/README.md 3 个 P3 问题(空 passphrase、任务名称不一致 ×2)
.devcontainer/devcontainer.json 无问题
.devcontainer/git-safe-pull.sh 1 个 P2 问题(stash push 失败导致 pull 被跳过)
.devcontainer/initialize.sh 无问题
.devcontainer/post-create.sh 1 个 P1 问题(缺失函数)
.gitignore 无问题
.vscode/launch.json 无问题
.vscode/settings.json 无问题
.vscode/tasks.json 无问题
build.py 1 个 P3 问题(日志与实际行为不一致)

整体风险评估

  • 最高风险项(P1)post-create.shfix_file_watcher_limit 函数缺失会导致 inotify 限制无法提升,影响容器内 VS Code 文件监视能力。应尽快补充该函数实现。
  • 中等风险项(P2)git-safe-pull.sh 在新版 Git 下可能静默跳过 git pull,虽不丢数据但会造成代码未更新的困惑,建议增加容错。
  • 低风险项(P3):文档不一致和日志误导问题不影响功能正确性,但会降低开发体验和文档可信度,建议修复。
类型 数量
🔴 阻塞 2
🟡 建议 2

⛔ 需要修改

likedislike
ascend-robotascend-robot成员
7月22日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
7月22日 评论:

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/mskl 龚思维, wiyr0 (2/2) 龚思维, wiyr0 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

mengguangxin, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robot
ascend-robot成员
7月22日 评论:

ascend docs pipeline is running...

likedislike
此处折叠了92条消息 查看更多
wiyr0wiyr0成员
7月23日 解决了最后一个问题
wiyr0
wiyr0成员
7月23日 评论:

/approve

likedislike
ascend-robotascend-robot成员
7月23日 添加了label:lgtm
ascend-robotascend-robot成员
7月23日 合入了pull request
ascend-robot
ascend-robot成员
7月23日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike