Skip to content

feat(ci): add DDE group version guard - #817

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:feat/verify-group-version
Nov 16, 2026
Merged

BLumia merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:feat/verify-group-version

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

变更内容

  • 参照已有 changelog 接入方式,新增公共 verify-group-version.yml、成员调用模板和 25 份仓库同步配置。
  • 组成员收敛为 G1、G2:G1 8 个仓库,G2 17 个仓库。
  • G2 移除 dde-polkit-agent、dde-session-ui、dde-clipboard、dcc-insider-plugin、deepin-pw-check、dde-app-services,保留 dde-appearance。
  • 不再为 G3/G4 及其余不参与组发布的仓库安装 guard 入口。
  • 校验普通 PR 不产生版本漂移;成员改版必须匹配同组织 dde 的原始发布记录,包括仓库、分支、目标版本、epoch 和创建时间。
  • 同一 SHA 的全部开放 PR 统一校验;最终发布状态前复核 PR 集合、提交、来源和目标分支。
  • 校验和状态写入失败均 fail closed;本 PR 不修改现有 Auto Release、update-changelog 或同步工具。

验证

  • test_verify_group_version.py:33 项通过。
  • .github 中的 25 份 guard JSON 与 dde/groups.yaml 的仓库映射一致,无缺失或多余。
  • 两个工作流 YAML 解析通过。

上线边界

本 PR 只安装公共工作流、调用模板和同步配置,不直接启用成员必需检查。上线后仍需逐仓库读回入口,验证状态来源,再按部署文档依次试点 G1、启用 G2。

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Sorry @MyLeeJiEun, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 1 hour by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Add the reusable workflow and caller template that expose the group-version check to member repositories.

  • .github/workflows/verify-group-version.yml L1-226
  • workflow-templates/call-verify-group-version.yml L1-14

Configuration

Install the guard template through sync configuration for the 25 G1-G2 member repositories.

  • repos/linuxdeepin/dde-api.json L77-83, L85 (removed lines)
  • repos/linuxdeepin/dde-appearance.json L67-73, L75 (removed lines)
  • repos/linuxdeepin/dde-application-manager.json L67-73, L75 (removed lines)
  • repos/linuxdeepin/dde-control-center.json L93-99
  • repos/linuxdeepin/dde-daemon.json L77-83, L85 (removed lines)
  • repos/linuxdeepin/dde-launchpad.json L79-85, L87 (removed lines)
  • repos/linuxdeepin/dde-network-core.json L98-104, L106 (removed lines)
  • repos/linuxdeepin/qt5integration.json L83-90 (+10 small edits)
  • repos/linuxdeepin/qt5platform-plugins.json L83-90 (+10 small edits)
  • repos/linuxdeepin/dde-services.json L8-14
  • repos/linuxdeepin/dde-session-shell-snipe.json L8-14
  • repos/linuxdeepin/dde-session.json L67-73, L75 (removed lines)
  • repos/linuxdeepin/dde-shell.json L79-85, L87 (removed lines)
  • repos/linuxdeepin/dde-tray-loader.json L60-66
  • repos/linuxdeepin/deepin-service-manager.json L92-98, L100 (removed lines)
  • repos/linuxdeepin/deepin-update-ui.json L70-76
  • repos/linuxdeepin/dtkcommon.json L77-83
  • repos/linuxdeepin/dtkcore.json L116-122
  • repos/linuxdeepin/dtkdeclarative.json L116-122
  • repos/linuxdeepin/dtkgui.json L116-122
  • repos/linuxdeepin/dtklog.json L71-77
  • repos/linuxdeepin/dtkwidget.json L116-122
  • repos/linuxdeepin/go-dbus-factory.json L77-83, L85 (removed lines)
  • repos/linuxdeepin/go-lib.json L77-83
  • repos/linuxdeepin/xdg-desktop-portal-dde.json L67-73

Documentation

Document the guard’s validation model, rollout boundaries, and required-check setup.

  • README.md L42-67

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Comment thread README.md Resolved
@MyLeeJiEun
MyLeeJiEun force-pushed the feat/verify-group-version branch from ceb9406 to 2af3880 Compare November 13, 2026 05:39

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要顺带rename下文件名

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@MyLeeJiEun
MyLeeJiEun force-pushed the feat/verify-group-version branch 4 times, most recently from 53e9e93 to a451d47 Compare November 13, 2026 07:51
Add the shared guard workflow, caller template, and sync configs for the 25 G1-G2 members.

Log: Add the DDE group version guard.
Influence: Current group member PRs can be validated against DDE release records.
PMS: TASK-398637
@MyLeeJiEun
MyLeeJiEun force-pushed the feat/verify-group-version branch from a451d47 to cdf15c3 Compare November 13, 2026 08:22
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 88 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本 PR 新增 DDE 组成员版本校验工作流(verify-group-version.yml)及其调用模板, 并为 25 个组成员仓库配置该模板。核心 Python 脚本逻辑正确,安全权限配置合理, 使用 pull_request_target 且不检出 PR 代码,subprocess 均使用列表参数防止注入。 存在少量代码质量与性能优化空间(缺少 timeout-minutes、identity 函数重复、 baseline PR 查询使用 state:all 可能匹配到已关闭的记录、release_record 最多 发起 101 次串行 API 调用),但不构成安全漏洞。四维度均通过或接近通过阈值, 总分 88 分,审查通过。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['在获取 baseline_pr 后增加对其状态的判断逻辑,或在使用 state:"all" 的同时 增加 baseline_pr["state"] == "open" 或 merged_at 的校验,确保不会使用 已放弃的过期发布记录']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: [{'在 verify job 中添加 timeout-minutes': '15 或适当值'}, '考虑将公共逻辑提取到独立脚本文件中以消除 identity() 重复', '统一 go-dbus-factory.json 中的键名为 "branches" 或确认两种形式均被支持', '为关键函数添加 docstring 说明参数和返回值']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['为 api() 函数添加简单的重试逻辑(如 3 次重试 + 指数退避)', '考虑对 release_record 的遍历结果做短期缓存(同一 PR 校验周期内)']


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: ['安全配置完善,建议保持当前权限模型。可考虑在未来版本中增加对 API 响应 数据的 schema 校验以增强防御性编程']


💡 改进建议代码示例

# .github/workflows/verify-group-version.yml - 建议改进

jobs:
  verify:
    name: Verify group version
    runs-on: ubuntu-latest
    timeout-minutes: 15  # 添加超时设置
    concurrency:
      group: group-version-guard-${{ github.event.pull_request.head.sha }}
      cancel-in-progress: false

# api() 函数添加重试逻辑
def api(path, paginate=False, retries=3):
    import time
    args = ["gh", "api", path]
    if paginate:
        args += ["--paginate", "--slurp"]
    for attempt in range(retries):
        result = subprocess.run(args, capture_output=True, text=True)
        if not result.returncode:
            break
        if attempt < retries - 1:
            time.sleep(2 ** attempt)
    if result.returncode:
        raise RuntimeError(f"GitHub API 失败: {path}: {result.stderr.strip()}")
    value = json.loads(result.stdout)
    return [item for page in value for item in page] if paginate else value

# baseline PR 查询建议增加状态校验
# 在获取 baseline_pr 后添加:
# if baseline_pr["state"] not in ("open", "closed"):
#     raise RuntimeError("DDE 基线 PR 状态异常")
# # closed 且 merged_at 为 None 表示被放弃,不应使用

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@BLumia
BLumia merged commit 88d36ae into linuxdeepin:master Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants