Repository navigation
ci(release): wait for CI Success as long as CI's slowest required chain - #350
Merged
Merged
Conversation
Give verify-ci's "Wait for exact-SHA CI Success" step the id exact_ci. Nothing reads the id yet and the step's behavior is unchanged. scripts/tests/release-ci-override.test.sh extracts the steps it runs against its stub gh by step id. Without an id, a stub case for the exact-SHA wait would stop at extraction with exit 2 instead of failing on the wait's 120-poll cap, so the id comes first. Verified: scripts/tests/ci-gate.test.sh (16 passed) and scripts/tests/release-ci-override.test.sh (31 passed) stay green, and actionlint passes on every workflow.
Add a release-wait rule to scripts/check-ci-gate.sh. It takes the longest needs path of job timeout-minutes that ends at ci-success in ci.yml (an unset limit counts as GitHub's default 360) and requires: - the exact-SHA wait step's CI_WAIT_MINUTES to be at least that sum; - verify-ci's timeout-minutes to be at least CI_WAIT_MINUTES + 15; - the release verify job's limit to be at least the limit ci.yml gives the job that runs the same make check; - the wait step to poll by CI_WAIT_MINUTES instead of a fixed seq count. Extract the exact_ci step in scripts/tests/release-ci-override.test.sh and run it against the existing gh and sleep stubs, with the workflow's own CI_WAIT_MINUTES unless a case sets one: - Y1: CI Success is in progress for 121 polls, then passes; exit 0. - Y2: CI_WAIT_MINUTES=1 and CI never finishes; exit 1 after exactly four calls to the jobs endpoint. - Y3: no push run ever appears; exit 1 after four calls. - Y4: the push run appears on the third call; the jobs endpoint gets the two polls left. - Y5: CI Success failed; exit 1 after one call. Y1 and Y2 are the plan's U and V; those letters already name PR-CI cases in this file. Y3 and Y4 check that the two loops share one budget, and Y5 checks that a failed CI still stops the wait at once. This commit is red. The release workflow still caps each loop at 120 polls of 15 seconds, has no CI_WAIT_MINUTES, and gives verify 30 minutes against Linux CI's 45: ci-gate.test.sh fails A_repository and B_pristine (14 passed, 2 failed), and release-ci-override.test.sh fails Y1 to Y4, Y2 with 120 jobs calls instead of 4 (35 passed, 7 failed). Y5 and the 31 existing cases pass. shellcheck passes on both scripts.
On v0.56.0's first Release attempt (run 45864204121), Verify CI Passed gave up after 31.3 minutes while the release commit's CI run 45864204084 needed 42.5, so the release stayed a draft until the failed jobs were re-run. Each of the step's two loops stopped after 120 polls of 15 seconds, and the job's limit was 35 minutes. CI's slowest required chain is Workspace Version (10 minutes), Windows Tests (60) and CI Success (5): 75 minutes of job limits. - The exact-SHA wait step gets CI_WAIT_MINUTES: "90", which leaves 15 minutes for runner queueing. Finding the push run and waiting for its CI Success now share one budget of CI_WAIT_MINUTES * 4 polls, one spent before each 15-second sleep, and both timeout messages print the minutes. - verify-ci's limit goes from 35 to 110 minutes: the wait plus room for its API calls and the earlier steps. - verify's limit goes from 30 to 45 minutes, the limit of ci.yml's Linux job, which runs the same make check. v0.56.0's verify job took 22.0 minutes. - The publish-time re-check after the PR-CI fallback is unchanged. - check-ci-gate.sh's fixed-poll rule now looks only for seq. Its other condition, that the step mentions CI_WAIT_MINUTES, was met by the timeout messages alone; the stub cases check the budget by behavior. - ci-gate.test.sh gets guard fixtures: Q (wait 90 to 60), R (Windows Tests 60 to 100 with the wait unchanged), S (verify-ci 110 to 35), T (verify 45 to 30) and U (a seq 1 120 loop again) must all fail. - CONTRIBUTING.md describes the three limits the checker keeps in step with ci.yml. Verified: ci-gate.test.sh passes 21 of 21, A_repository and B_pristine included; release-ci-override.test.sh passes 42 of 42, Y1 to Y4 included, which failed at d56ecda. make script-tests, make workflow-lint (actionlint 1.7.12, shellcheck 0.11.0), make docs-check, make fmt-oxfmt-check (oxfmt 0.64.0) and make guardrail pass. Disabling any one release-wait rule in a scratch copy fails exactly its fixtures, and scratch step bodies with two budgets, a 120-poll cap, or polling past a failed CI Success fail the matching stub cases.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #350 +/- ##
==========================================
- Coverage 96.40% 96.40% -0.01%
==========================================
Files 368 368
Lines 254382 254382
==========================================
- Hits 245229 245228 -1
- Misses 9153 9154 +1 see 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verify CI Passednow waits for the release commit'sCI Successfor as long as CI's slowest required chain can take. A contract check keeps that wait in step withci.yml..github/workflows/release.yml, exact-SHA wait step (nowid: exact_ci):CI_WAIT_MINUTES: "90". Finding the CI push run and waiting for itsCI Successnow share one budget ofCI_WAIT_MINUTES * 4polls, one spent before each 15-second sleep. This replaces two fixedseq 1 120loops, and both timeout messages print the minutes.verify-cijob limit goes from 35 to 110 minutes: the wait plus room for its API calls and the earlier steps. The releaseverifyjob limit goes from 30 to 45 minutes, the limit ofci.yml's Linux job, which runs the samemake check. v0.56.0's verify job took 22 min.scripts/check-ci-gate.sh(run bymake guardrailandscripts/tests/ci-gate.test.sh) gets arelease-waitrule. It sumstimeout-minutesalong the longestneedspath ending atci-success, counting an unset limit as GitHub's 360. It then requires:CI_WAIT_MINUTESto be at least that sum (todayworkspace-version 10 + windows-test 60 + ci-success 5 = 75);verify-cilimit to be at leastCI_WAIT_MINUTES + 15;verifylimit to be at least that of theci.ymljob runningmake check;seqloop in the wait step.scripts/tests/release-ci-override.test.shruns the exact-SHA wait against its stubgh.CONTRIBUTING.md(Releases) lists the three limits the checker keeps in step withci.yml.Why
v0.56.0's Release run 45864204121 did not publish on its first attempt.
Verify CI Passed(job 140062920295) ran from 17:02:48 to 17:34:04 UTC and failed when its second 120-poll loop ran out. The release commit's CI push run 45864204084 ran from 17:02:20 to 17:44:54 (42 min 34 s). The release was published only after the failed jobs were re-run.The job limits in
ci.ymlletCI Successarrive up to 75 minutes after the run starts (Workspace Version 10, Windows Tests 60, CI Success 5), before runner queueing. A 30-minute wait can therefore fail a healthy release. 90 minutes covers the 75 with 15 to spare for queueing, which also meets the agreed minimum of 60.Verification
Red, at d56ecda (contract and stub cases added, workflow unchanged):
bash scripts/tests/ci-gate.test.sh: 14 passed, 2 failed.A_repositoryandB_pristinefail with:bash scripts/tests/release-ci-override.test.sh: 35 passed, 7 failed.Y1_ci_after_121_polls(CI Success passes on poll 122) ends withtimed out waiting for CI Success in run 40000000001, which is the old 120-poll cap.Y2_one_minute_budget(CI_WAIT_MINUTES=1, never done) calls the jobs endpoint 120 times instead of 4.Y3_no_push_runcalls the runs endpoint 120 times instead of 4.Y4_shared_budget(run found on the third call) calls the jobs endpoint 120 times instead of 2.Y5_ci_failedand the 31 existing cases pass.Green, at 475d473:
make script-tests: ci-gate 21/21, release-ci-override 42/42; the other harnesses are unchanged.make workflow-lint(actionlint 1.7.12, shellcheck 0.11.0),make docs-check,make fmt-oxfmt-check(oxfmt 0.64.0),make guardrail,cargo fmt --all --checkandgit diff --checkall pass.needscycle or an undefined need exits 2 with an ERROR line;CI_WAIT_MINUTES: 90unquoted passes;"90m"or a missing value fails.The pre-push
make pre-cipassed on 475d473; its guardrail printedrelease wait : CI_WAIT_MINUTES 90 >= workspace-version 10 + windows-test 60 + ci-success 5 = 75; verify-ci 110 >= 90 + 15; verify 45 >= make check 45.Notes
Y1andY2here, because U and V already name PR-CI cases in that file.Y3andY4pin the shared budget, andY5pins that a failed CI Success still stops the wait at once. The ci-gate fixtureU_fixed_pollsguards theseqrule next to Q to T.seqrule first also required the step to mentionCI_WAIT_MINUTES, but the timeout messages alone met that. The last commit drops that condition, and the stub cases check the budget by behavior.verifyrule finds theci.ymljob by itsmake checkstep, not by the namelinux.gh apicall still ends the wait (set -euo pipefail). The longer wait makes up to about 360 calls instead of 240.release.ymlof the release commit. WhetherVerify CI Passedpasses on the first attempt will only be known at release time.