mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-24 11:26:29 +00:00
ci(chain): fall back to auto-testing main HEAD when the pinned harness goes stale (#8026)
The functional chain pins the test harness to the revision recorded in .config/functional-script-revision.txt, which is only refreshed by release syncs - it went stale on Sep 16 and the nightly chain has been replaying a Sep-17-era harness ever since. Last night that meant: the performance lane died on a dpkg conffile prompt (fix merged as #88 but never reached the chain), the FT lane died on 'unknown option: --results-file' (harness/workflow version mismatch), and the STS-105 signing fix (#94) sat untested. When the pinned revision's commit is older than 24 hours, fall back to auto-testing main HEAD so the chain always runs the current harness. Any staleness-probe failure keeps the pinned revision (fail-safe). The revision file stays in place as the audit trail and the release sync continues to manage it.
This commit is contained in:
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
@@ -112,6 +113,25 @@ def prepare():
|
||||
candidate = resolve(run_id, attempt)
|
||||
revision = (ROOT / ".config/functional-script-revision.txt").read_text().strip()
|
||||
require(sha(revision), "private test script revision must be pinned")
|
||||
# The revision file is refreshed only by release syncs and goes stale
|
||||
# within days, so the nightly chain keeps replaying an old harness while
|
||||
# fixes (conffile prompts, FT --results-file, tier retries, STS-105
|
||||
# signing) sit untested on auto-testing main. When the pinned revision is
|
||||
# older than a day, fall back to auto-testing main HEAD. Any probe
|
||||
# failure keeps the pinned revision - the chain still runs, just on the
|
||||
# old harness.
|
||||
try:
|
||||
head = api("repos/rustfs/auto-testing/git/ref/heads/main")["object"]["sha"]
|
||||
pinned_date = api(f"repos/rustfs/auto-testing/commits/{revision}")["commit"]["committer"]["date"]
|
||||
pinned_at = datetime.fromisoformat(pinned_date.replace("Z", "+00:00"))
|
||||
age_hours = (datetime.now(timezone.utc) - pinned_at).total_seconds() / 3600
|
||||
if age_hours > 24:
|
||||
print(f"functional-script revision {revision[:8]} is {age_hours:.0f}h old; falling back to auto-testing main HEAD {head[:8]}")
|
||||
revision = head
|
||||
else:
|
||||
print(f"functional-script revision {revision[:8]} is {age_hours:.0f}h old; keeping pin")
|
||||
except Exception as error:
|
||||
print(f"staleness probe failed ({error}); keeping pinned revision {revision[:8]}")
|
||||
chain = {"schema": 1, "run_id": int(os.environ["GITHUB_RUN_ID"]), "attempt": int(os.environ["GITHUB_RUN_ATTEMPT"]),
|
||||
"workflow_sha": os.environ["GITHUB_SHA"], "testing_sha": revision, "candidate": candidate}
|
||||
encoded = json.dumps(chain, sort_keys=True, separators=(",", ":"))
|
||||
|
||||
Reference in New Issue
Block a user