ci: upload only what the run wrote, and a failed upload is a warning (#184)

scripts/nightly.sh run-logs gathers the logs and DoE CSVs newer than
the run's start, and the stages' output, into build/nightly/run-logs/;
acceptance, nightly and release upload that, not every log in the
tree, with continue-on-error (Captain Bob: "A warning only").
scripts/test_nightly_run_logs.sh: 5 of 8 failed first; its own error
(nightly.sh works from the repository root) corrected with
NIGHTLY_TREE; 8 pass. To see: CI's next acceptance uploads a handful.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 22:52:21 +00:00
parent 9db364f7c7
commit 20918f9f09
7 changed files with 105 additions and 12 deletions
+9 -5
View File
@@ -75,13 +75,17 @@ jobs:
if: failure()
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
# warning (continue-on-error), and cannot turn a passing run red.
- name: This run's logs and DoE CSVs, gathered
if: always()
run: scripts/nightly.sh run-logs || true
- name: Keep the logs and DoE CSVs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: acceptance-logs-${{ github.run_number }}
path: |
logs/
experiments/bare_metal/runs/
build/nightly/accept-*.txt
build/nightly/test-32.txt
path: build/nightly/run-logs/
+9 -3
View File
@@ -101,11 +101,17 @@ jobs:
if: failure()
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
# warning (continue-on-error), and cannot turn a passing run red.
- name: This run's logs and DoE CSVs, gathered
if: always()
run: scripts/nightly.sh run-logs || true
- name: Keep the logs and DoE CSVs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: logs-${{ github.run_number }}
path: |
logs/
experiments/bare_metal/runs/
path: build/nightly/run-logs/
+9 -3
View File
@@ -111,11 +111,17 @@ jobs:
if: failure()
run: scripts/nightly.sh diagnose # build only; the failed step stays the job's failure
# #184 (Captain Bob, 2026-11-20: "A warning only"): only what this run wrote is uploaded -- the logs and
# CSVs newer than its start, and the stages' output (scripts/nightly.sh run-logs) -- not every log in
# the tree. The upload is a copy for convenience, the evidence is committed: a failed upload is a
# warning (continue-on-error), and cannot turn a passing run red.
- name: This run's logs and DoE CSVs, gathered
if: always()
run: scripts/nightly.sh run-logs || true
- name: Keep the logs and DoE CSVs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: release-logs-${{ github.ref_name }}
path: |
logs/
experiments/bare_metal/runs/
path: build/nightly/run-logs/
+9
View File
@@ -0,0 +1,9 @@
PASS: the stage succeeds
PASS: this run's serial log is kept
PASS: this run's DoE CSV is kept
PASS: the stages' own output is kept
PASS: an older log is not
PASS: an older CSV is not
PASS: it says how many files
PASS: with no run started, it refuses
RESULT: PASS
+9
View File
@@ -0,0 +1,9 @@
FAIL: the stage succeeds
FAIL: this run's serial log is kept
FAIL: this run's DoE CSV is kept
FAIL: the stages' own output is kept
PASS: an older log is not
PASS: an older CSV is not
FAIL: it says how many files
PASS: with no run started, it refuses
RESULT: FAIL
+18 -1
View File
@@ -19,6 +19,10 @@
# found, and one value (#172 -- it was one distinct value, which two of the three could make).
# scripts/nightly.sh test-32
# make -C v4 test-32: v4 with 32-bit cells, every test (the acceptance's last part).
# scripts/nightly.sh run-logs
# What this run wrote, gathered for CI to upload (#184): the files under logs/ and
# experiments/bare_metal/runs/ newer than the run's start ($OUT/.started), and the stages' own
# output ($OUT/*.txt), copied with their paths into $OUT/run-logs/. Not every log in the tree.
# scripts/nightly.sh capsule-trust
# A signed build with one capsule's signature taken out (v4:centre.4th), booted on amd64: the kernel
# must refuse it and stop (#139; plan 2026-11-20-capsule-trust.md, ruling 4, "Left to CI"). Needs
@@ -94,7 +98,7 @@ DOCS=build/nightly-docs
LITHOS=$(sed -n 's/^LITHOS_VERSION *?= *//p' kernel/Makefile)
VERSION=${NIGHTLY_VERSION:-$LITHOS-SNAPSHOT}
usage() {
echo "Usage: scripts/nightly.sh accept <amd64|aarch64|riscv64|stick-high> | test-32 | capsule-trust | v4-checks | proofs | images" >&2
echo "Usage: scripts/nightly.sh accept <amd64|aarch64|riscv64|stick-high> | test-32 | capsule-trust | run-logs | v4-checks | proofs | images" >&2
echo " | publish <URL> | docs | publish-docs <URL> | gitea-release <tag>" >&2
echo " | protocol [<stage>...] | protocol-report | dict-hash | post-count" >&2
echo " | diagnose [<stage that failed>]" >&2
@@ -196,6 +200,19 @@ dict-hash)
echo "nightly: the three architectures do not agree on dict_hash -- $(tr '\n' ' ' <<<"$distinct")" >&2; exit 1
fi
;;
run-logs)
need "$OUT/.started"
rm -rf "$OUT/run-logs"; mkdir -p "$OUT/run-logs"
out_abs=$(cd "$OUT" && pwd)
(cd "${NIGHTLY_TREE:-.}" && # NIGHTLY_TREE: the tests' scratch tree (scripts/test_nightly_run_logs.sh)
find logs experiments/bare_metal/runs -type f -newer "$out_abs/.started" -print0 2>/dev/null \
| while IFS= read -r -d '' f; do mkdir -p "$out_abs/run-logs/$(dirname "$f")"; cp -p "$f" "$out_abs/run-logs/$f"; done)
for f in "$OUT"/*.txt; do
[ -f "$f" ] || continue
mkdir -p "$OUT/run-logs/$(basename "$OUT")"; cp -p "$f" "$OUT/run-logs/$(basename "$OUT")/"
done
echo "=== nightly: run-logs: $(find "$OUT/run-logs" -type f | wc -l) files, this run's, in $OUT/run-logs"
;;
capsule-trust)
git checkout -q -- disk/zuse-scratch
python3 scripts/qemu_session.py unsigned_capsule amd64 --label nightly-capsule-trust --make "QEMU_DISPLAY=none"
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# test_nightly_run_logs.sh -- the tests of `scripts/nightly.sh run-logs` (#184): what CI uploads is
# only what this run wrote -- the files under logs/ and experiments/bare_metal/runs/ newer than the
# run's start ($OUT/.started), and the stages' own output in $OUT -- not every log in the tree.
# No QEMU: a scratch tree with old and new files.
#
# Prints PASS:/FAIL: per check and RESULT:; exits 0 only if every check passes.
set -uo pipefail
NIGHTLY="$(cd "$(dirname "$0")" && pwd)/nightly.sh"
T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT
ok=1
check() { if eval "$2"; then echo "PASS: $1"; else echo "FAIL: $1"; ok=0; fi; }
cd "$T"
mkdir -p logs/old/amd64 experiments/bare_metal/runs out
echo old > logs/old/amd64/qemu-amd64-old.log
echo old > experiments/bare_metal/runs/doe-old.csv
touch -d '2026-01-01' logs/old/amd64/qemu-amd64-old.log experiments/bare_metal/runs/doe-old.csv
touch out/.started
sleep 1
mkdir -p logs/new/amd64
echo new > logs/new/amd64/qemu-amd64-new.log
echo new > experiments/bare_metal/runs/doe-new.csv
echo stage > out/accept-amd64.txt
NIGHTLY_TREE="$T" NIGHTLY_OUT="$T/out" bash "$NIGHTLY" run-logs > run.txt 2>&1; rc=$?
check "the stage succeeds" '[ $rc -eq 0 ]'
check "this run's serial log is kept" '[ -f out/run-logs/logs/new/amd64/qemu-amd64-new.log ]'
check "this run's DoE CSV is kept" '[ -f out/run-logs/experiments/bare_metal/runs/doe-new.csv ]'
check "the stages' own output is kept" '[ -f out/run-logs/out/accept-amd64.txt ]'
check "an older log is not" '[ ! -e out/run-logs/logs/old ]'
check "an older CSV is not" '[ ! -e out/run-logs/experiments/bare_metal/runs/doe-old.csv ]'
check "it says how many files" 'grep -q "run-logs: 3 files" run.txt'
rm -rf out/run-logs; rm out/.started
NIGHTLY_TREE="$T" NIGHTLY_OUT="$T/out" bash "$NIGHTLY" run-logs > run2.txt 2>&1; rc=$?
check "with no run started, it refuses" '[ $rc -ne 0 ]'
echo "RESULT: $([ $ok = 1 ] && echo PASS || echo FAIL)"
[ $ok = 1 ]