Repository navigation
feat: archive build logs per run under /log/<date>-<run-id>/ - #6
Merged
Merged
Conversation
Build logs used to be published as a single flat set, so each publish overwrote the previous run's logs and only the most recent build of a package was ever available. The package log files are now archived into a directory per workflow run: /log/2026-12-01-46640252167/zitzhen-patchsplit.log The run directory is <UTC date>-<run id>, so a new publish adds a directory instead of replacing files and older runs stay readable. Implementation: - log-run-dir.sh derives the directory from github.run_started_at and github.run_id. It lives in a script rather than inline in the run: block: shell written into a workflow is only exercised in CI, and a bad substitution there already broke every build once. - collect-logs.sh takes the run directory as an optional third argument and writes into log/<run-dir>/. It defaults to "latest" for local runs and rejects anything that is not a single safe path component, so a malformed value cannot escape log/. - publish-apt.yml passes the run directory when staging, and keeps the existing behaviour of staging logs before publish-repo.sh so log/ stays in the root index. Two consequences of no longer overwriting, both handled: - The /log/ listing is regenerated from the run directories that actually exist in the bucket, not from the staged tree, which only knows the current run. Without this the listing would drop every previous run. stage-log-index.sh builds that index and the workflow unions the bucket's CommonPrefixes with the current run directory. - The sync still runs without --delete, so archiving a run never removes an older one. Pruning is left as a manual decision, and the docs say so. The R2 sync keeps its three content-typed passes. The plain-text pass now uses log/ as its source root instead of a repo-wide 'log/**' include, because that include would also match log/<run>/index.html and overwrite the text/html type set by the pass before it. Tests: script-checks.yml gains the run directory derivation (including rejection of non-numeric ids and path traversal) and the archived layout, asserting logs land under the run directory, that the root and /log/ indexes link to it, and that a /log/ index rebuilt from the bucket lists past runs as well as the current one. Also verified locally by simulating two consecutive publishes, confirming the first run's logs survive the second unchanged. Signed-off-by: Oliver Lin <oliver@liuxiaozhen.dev>
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.
Build logs used to be published as a single flat set, so each publish overwrote the previous run's logs and only the most recent build of a package was ever available. The package log files are now archived into a directory per workflow run:
/log/2026-12-01-46640252167/zitzhen-patchsplit.log
The run directory is -, so a new publish adds a directory instead of replacing files and older runs stay readable.
Implementation:
Two consequences of no longer overwriting, both handled:
The R2 sync keeps its three content-typed passes. The plain-text pass now uses log/ as its source root instead of a repo-wide 'log/**' include, because that include would also match log//index.html and overwrite the text/html type set by the pass before it.
Tests: script-checks.yml gains the run directory derivation (including rejection of non-numeric ids and path traversal) and the archived layout, asserting logs land under the run directory, that the root and /log/ indexes link to it, and that a /log/ index rebuilt from the bucket lists past runs as well as the current one. Also verified locally by simulating two consecutive publishes, confirming the first run's logs survive the second unchanged.