mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-30 03:44:38 +01:00
A land that waits on an earlier CI run decides on what that run did, and main's reuse skips cancelled runs (GST-3634) (#4763)
A land that waits on an earlier CI run now goes by that run's real result, and main's Free Tests run skips a cancelled run when it looks for a land's run. Why: a green run rerun at the moment land picked it up could have its red result ignored, and a cancelled run made main rerun the whole suite. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
6ef3861302
commit
7c321fff5d
6 files changed
+25
-8
No files matched your search
@@ -19,7 +19,7 @@
|
||||
* first one lib/run-evidence.ts verifyRun accepts under the profile in the pushed tree's
|
||||
* .gstack/pregate.json. A pull_request run counts only when its merge commit's tree is its head's tree
|
||||
* (verifyRun). When the head's tree differs (land merged a stale-base pin), the only candidate is the newest
|
||||
* workflow_dispatch run on landBranch(<pr>), the run land.merged_ci gated the merge on, and it counts only when
|
||||
* workflow_dispatch run on landBranch(<pr>) that was not cancelled, the run land.merged_ci gated the merge on, and it counts only when
|
||||
* verifyRun accepts it with the pushed tree as its tested tree (newest by run id, so a re-run of an older land run
|
||||
* never outranks a later red one): that run executed this same tree's workflow, so
|
||||
* the rules it ran under are the ones now on main. It writes reused=true, run_id, run_url and tree to GITHUB_OUTPUT, or reused=false and a
|
||||
@@ -79,7 +79,7 @@ export function findReuse(deps: ReuseDeps, o: { repo: string; base: string; push
|
||||
const mismatch = `#${pr.number}'s head ${pr.head.sha.slice(0, 12)} has tree ${headTree.slice(0, 12)}, the push has ${pushTree.slice(0, 12)}`;
|
||||
const branch = landBranch(pr.number);
|
||||
const land = events.includes('workflow_dispatch')
|
||||
? deps.runsForBranch(o.workflow, branch).filter(r => r.event === 'workflow_dispatch' && r.head_branch === branch).sort((a, b) => b.id - a.id)[0]
|
||||
? deps.runsForBranch(o.workflow, branch).filter(r => r.event === 'workflow_dispatch' && r.head_branch === branch && r.conclusion !== 'cancelled').sort((a, b) => b.id - a.id)[0]
|
||||
: undefined;
|
||||
if (!land) return refuse('tree_mismatch', `${mismatch}, and ${branch} has no workflow_dispatch run of ${o.workflow}`);
|
||||
const v = verifyRun(deps, { repo: o.repo, runRef: String(land.id), profileName: o.profileName, profile: o.profile, now: o.now });
|
||||
|
||||
Reference in new issue
Block a user