Skip to content

CI: nightly build hygiene + fix leftover runner directories - #448

Merged
mcdope merged 4 commits into
masterfrom
improve-nightlies
Jul 2, 2026
Merged

CI: nightly build hygiene + fix leftover runner directories#448
mcdope merged 4 commits into
masterfrom
improve-nightlies

Conversation

@mcdope

@mcdope mcdope commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Nightly build workflow now skips the build entirely when master hasn't advanced since the last nightly tag, instead of rebuilding/republishing identical packages every night regardless of changes.
  • Drops the redundant .tar.gz source package from nightly builds, since GitHub already auto-generates source tarballs for every tag it publishes to (including nightly).
  • Fixes three leftover-directory bugs on the self-hosted build runner: Debian-riscv64's Cleanup step never actually removed its checkout directory (leaked on every run), and Debian-arm64/Debian-armhf deferred cleanup to downstream FunctionalTest-* jobs that only run on push, so every pull_request run left those directories behind permanently.
  • Adds a new scheduled workflow that sweeps the runner for any orphaned pam_usb_*<digits> directories older than 3 hours, as a safety net against future cleanup-step bugs of the same shape (a similar gap in a now-deleted workflow is why the runner had accumulated ~800MB/165 directories going back to May, since manually cleared as a one-time sweep).

Why this approach

  • The nightly skip-gate compares master's HEAD against the commit the nightly tag currently points to (via the GitHub API), rather than anything more complex, since that's exactly what "has anything changed since last nightly" means operationally.
  • For arm64/armhf, self-cleaning only on non-push events (rather than always self-cleaning, or making FunctionalTest-* unconditional) was chosen specifically to preserve the deliberate push-path optimization where those jobs reuse the already-built .deb instead of rebuilding it.
  • The sweep uses an include pattern (pam_usb_* ending in a digit) rather than an exclude-list, so it automatically stays safe against the hand-maintained pam_usb_reprovision checkout and the persistent pam_usb clone without needing to know about them explicitly.

Test plan

  • YAML validated for all modified/added workflow files
  • Verified via SSH that Debian-riscv64's directory is removed after a build
  • Verified the sweep regex against synthetic test directories matching every current/historical naming pattern, confirming it excludes pam_usb_reprovision and the bare pam_usb clone
  • Ran the one-time historical sweep on the runner (165 dirs / 799M reclaimed), confirmed 0 remaining and both excluded directories untouched
  • Live verification of the arm64/armhf push-path .deb reuse still working (FunctionalTest-arm64/FunctionalTest-armhf finding and reusing the existing .deb rather than rebuilding) requires a push-triggered run after merge

🤖 This PR was generated with the assistance of Claude Code (Sonnet 5).

mcdope added 4 commits July 2, 2026 22:18
The nightly workflow ran unconditionally on every scheduled trigger,
rebuilding and republishing identical packages even when master hadn't
moved since the last nightly build (observed: daily reruns from
2026-06-23 through 2026-07-01 with zero new commits in that window).

Add a CheckForChanges job that compares master's HEAD against the
commit the "nightly" tag currently points to, and skip GenerateNightly
when they match. Manual workflow_dispatch runs always proceed.
GitHub already auto-generates source tarballs for every tag, including
the "nightly" tag this workflow publishes to, making the make sourcegz
step and its output pure duplication.
Debian-riscv64's Cleanup step only pruned Docker images and never
removed its own checkout directory, leaking it on every single run.
Debian-arm64/Debian-armhf had the same gap, deferring removal to
FunctionalTest-arm64/armhf downstream - but those jobs only run on
push events, so every pull_request run left the directory behind.

Debian-riscv64 now always removes its directory; Debian-arm64/armhf
only self-clean on non-push events, preserving the push-path .deb
reuse optimization for the FunctionalTest-* jobs.
Historical workflow changes (e.g. a since-deleted cross-arch QEMU
workflow with a buggy cleanup condition) have left directories on the
runner that no current workflow can ever clean up, and any future
cleanup-step authoring bug of the same shape would silently leak
forever with nothing catching it.

Sweeps ~ for directories matching pam_usb_*<digits> older than 3
hours. The pattern deliberately excludes anything not ending in a
digit, so the hand-maintained pam_usb_reprovision checkout and the
persistent pam_usb clone are never touched.
@mcdope mcdope added the bug Something isn't working label Jul 2, 2026
@mcdope mcdope self-assigned this Jul 2, 2026
@mcdope mcdope added enhancement New feature or request and removed bug Something isn't working labels Jul 2, 2026
@mcdope
mcdope merged commit b9fbeca into master Jul 2, 2026
24 checks passed
@mcdope
mcdope deleted the improve-nightlies branch July 2, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant