scripts/ci-clear-rolling-cache.py deletes the old rolling entries when
the cache warm leg's Post Setup step starts. It used to exit 0 at that
point, so a save that was canceled or failed afterwards left no rolling
entry while the job passed. The script now keeps polling the leg until
Post Setup completes or the leg ends, within the same 160-minute limit,
and exits 1 unless the save succeeded. A failure in a later post step
does not count once the save has succeeded. The header and the ci.yml
comment describe this, and say that the next run then starts cold.
Three new tests run main() with recorded API answers: a save that
succeeds after the deletion exits 0, and a save that is canceled or
fails after it exits 1.
scripts/ci-clear-rolling-cache.py:
- The 160-minute wait is timed from the cache warm leg's start, not from
the script's start. The clear job starts with the run, and the leg
starts after gate / select legs and a free runner. The job's timeout
goes from 170 to 200 minutes to leave room for that delay.
- The leg counts as saving when its Post Setup step (the gate-setup
action's cache save) starts, not when any Post step starts. A leg that
ends canceled or failed before that step succeeds deletes nothing and
exits 1, as a leg that failed before its save already did.
- actions/caches is read one page at a time, sorted by creation, until a
page holds fewer than 100 entries.
scripts/ci-clear-rolling-cache-tests.py checks the script with recorded
API answers, and Nightly check runs it when either file changes.