Prhub

#50197 [CI] Allow comment-triggered builds past pipeline filters

原始 PR 作者 khluu 合并时间 2026-07-29 10:11 文件变更 2 提交数 1 评论 0 代码增减 +2 / -0

执行摘要

允许评论触发的 CI 绕过 pipeline 分支过滤器

PR body 明确指出,live /ci run 测试到达 Buildkite 后收到 422: Build does not match the pipeline's filter condition 错误。pipeline 过滤器只接受 main 或标记了 ready/ready-run-all-tests 的 PR,这与评论驱动 CI 的预期工作流冲突。

可以合并,这是一次必要且简单的修复。值得关注的是 comment-based CI 工作流的演进,后续可能有更多功能扩展。

讨论亮点

无 review 讨论,仅 Claude bot 自动评论提示 fork PR 需要 maintainer 手动触发 review,ywang96 直接批准。

实现拆解

  1. 修改构建载荷生成函数:在 .github/workflows/scripts/run_ci_command.pycreate_build_payload 函数返回的字典中添加键 ignore_pipeline_branch_filters,值设为 True,使 Buildkite 创建构建时跳过 pipeline 分支过滤器。
  2. 更新测试断言:在对应测试文件 .github/workflows/scripts/test_run_ci_command.pytest_build_payload_preserves_pr_context 测试用例中,在预期 payload 字典里补上 "ignore_pipeline_branch_filters": True,确保测试通过。
文件 模块 状态 重要度
.github/workflows/scripts/run_ci_command.py CI 脚本 modified 3.61
.github/workflows/scripts/test_run_ci_command.py CI 脚本 modified 3.28

关键符号

create_build_payload

关键源码片段

.github/workflows/scripts/run_ci_command.py infrastructure

核心修改:在 `create_build_payload` 中添加 `ignore_pipeline_branch_filters: True`,使 Buildkite 跳过分支过滤器。

# .github/workflows/scripts/run_ci_command.py 中的 create_build_payload 函数
# 该函数构建发送到 Buildkite API 的构建请求字典def create_build_payload(
    actor: str,
    comment_id: int,
    pr: dict,
) -> dict:
    """创建 Buildkite 构建请求载荷。"""
    return {
        "commit": pr["head"]["sha"],
        "branch": pr["head"]["ref"],
        "message": f"PR #{pr['number']} /ci run by @{actor}",
        "pull_request_id": pr["number"],
        "pull_request_base_branch": pr["base"]["ref"],
        "pull_request_repository": pr["head"]["repo"]["clone_url"],
        "pull_request_labels": [
            label["name"] for label in pr["labels"]
        ],
        # 新增:显式要求 Buildkite 忽略 pipeline 分支过滤条件,
        # 允许来自未标记 PR 的评论也能触发生成构建。
        "ignore_pipeline_branch_filters": True,
        "env": {
            "VLLM_CI_GITHUB_COMMENT_ID": str(comment_id),
            "VLLM_CI_TRIGGERED_BY": actor,
        },
        "meta_data": {
            "github-comment-id": str(comment_id),
            "github-pr-number": pr["number"],
            "github-triggered-by": actor,
        },
    }

评论区精华

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

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

风险与影响

低风险。变更仅影响评论触发的构建请求,且只添加一个布尔字段,不改变现有逻辑。但如果 Buildkite API 不识别该字段,可能被忽略,但历史上 Buildkite 对未知字段一般静默忽略,不会导致失败。

影响范围很小:仅当用户使用 /ci run 评论触发 CI 时,不再因 PR 未达到 pipeline 过滤器标准而被拒绝。对主分支构建、手动触发等其他 CI 路径无影响。

简单变更,风险低

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论