pr_checker: ignore superseded GitHub Actions check suites when a head SHA is reused

未关闭
#1,151 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
github-actions, javascript
领域
ci-cd, tooling

调研方向

从 lib/pr_checker.js 开始:checkGitHubCI() 会遍历 lib/queries/PRCommits.gql 返回的 suites。使用链接的 nodejs/node 示例来了解同一个 head SHA 的重复运行,然后验证每个 workflow 只有最新的适用运行会影响结果,而较早的已被取代的运行不会阻止接受。

由索引模型根据 Issue 内容生成。

描述

PRChecker.checkGitHubCI() can incorrectly report a PR as having failed GitHub CI when its current head commit has both:

  • an older cancelled/failed GitHub Actions run; and
  • a newer successful run of the same workflow.

This can happen when a PR branch is force-pushed away from a commit and later force-pushed back to exactly the same SHA. GitHub
keeps both sets of check suites attached to that commit.

This occurred on nodejs/node#64803, https://github.com/nodejs/node/pull/64601 whose current head SHA is:

ee1ca501264411a3e993d4ed487f833fb0ffa841
a23d7a9a84a190e3804f9b2fb200feb833f3114a

Timeline:

  1. An Actions run was started for this SHA:
    https://github.com/nodejs/node/actions/runs/30359390795
  2. The PR branch was updated, causing that run to be cancelled by the workflow's cancel-in-progress configuration.
  3. The branch was subsequently force-pushed back to the same SHA:
    https://github.com/nodejs/node/pull/64803#event-28598521231
  4. A new run for the same SHA completed successfully:
    https://github.com/nodejs/node/actions/runs/30360481950
  5. The latest Jenkins CI also completed successfully:
    https://ci.nodejs.org/job/node-test-pull-request/75495/

However, the commit queue reported one failed and 15 cancelled GitHub Actions jobs from the older, superseded runs:

https://github.com/nodejs/node/pull/64803#issuecomment-5226872042

The commit checks page contains both the old cancelled suites and the newer successful suites:

https://github.com/nodejs/node/commit/ee1ca501264411a3e993d4ed487f833fb0ffa841/checks

The reported macOS failure was also produced while the old workflow was being cancelled, rather than by a test failure:

https://github.com/nodejs/node/actions/runs/30359390795/job/90275679554

The GraphQL query retrieves up to 100 check suites associated with the current commit:

https://github.com/nodejs/node-core-utils/blob/v7.0.1/lib/queries/PRCommits.gql#L28-L44

checkGitHubCI() then iterates over every GitHub Actions suite and treats any non-successful historical suite as a current
failure:

https://github.com/nodejs/node-core-utils/blob/v7.0.1/lib/pr_checker.js#L461-L515

It does not identify whether an older suite has been superseded by a newer run of the same workflow.

As a result, an obsolete cancelled or failed run can permanently prevent the commit queue from accepting that SHA, even though
all current CI runs succeeded.

For each GitHub Actions workflow, only the latest applicable run for the current head SHA should determine the CI result. Older
runs superseded by a newer run of the same workflow should be ignored.

Refs: https://github.com/nodejs/node/pull/64601#issuecomment-5226071594
Refs: https://github.com/nodejs/node/pull/64803#issuecomment-5226872042

主要语言
JavaScript
星标
313
派生
137
平均合并
2 天 8 小时
30 天内合并 PR
24

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/node-core-utils 的其他 Issue

查看 nodejs/node-core-utils 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。