diff --git a/.gitea/workflows/acceptance.yml b/.gitea/workflows/acceptance.yml index 4f4e7276..aa2c80ca 100644 --- a/.gitea/workflows/acceptance.yml +++ b/.gitea/workflows/acceptance.yml @@ -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/ diff --git a/.gitea/workflows/nightly.yml b/.gitea/workflows/nightly.yml index 766def71..8522a088 100644 --- a/.gitea/workflows/nightly.yml +++ b/.gitea/workflows/nightly.yml @@ -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/ diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ba4008b6..7f597525 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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/ diff --git a/logs/20261120-ci-uploads/test-after.txt b/logs/20261120-ci-uploads/test-after.txt new file mode 100644 index 00000000..363f836c --- /dev/null +++ b/logs/20261120-ci-uploads/test-after.txt @@ -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 diff --git a/logs/20261120-ci-uploads/test-before.txt b/logs/20261120-ci-uploads/test-before.txt new file mode 100644 index 00000000..42d172c1 --- /dev/null +++ b/logs/20261120-ci-uploads/test-before.txt @@ -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 diff --git a/scripts/nightly.sh b/scripts/nightly.sh index 5f22e165..de1e32f8 100755 --- a/scripts/nightly.sh +++ b/scripts/nightly.sh @@ -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 | test-32 | capsule-trust | v4-checks | proofs | images" >&2 + echo "Usage: scripts/nightly.sh accept | test-32 | capsule-trust | run-logs | v4-checks | proofs | images" >&2 echo " | publish | docs | publish-docs | gitea-release " >&2 echo " | protocol [...] | protocol-report | dict-hash | post-count" >&2 echo " | diagnose []" >&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" diff --git a/scripts/test_nightly_run_logs.sh b/scripts/test_nightly_run_logs.sh new file mode 100755 index 00000000..8d2f01d2 --- /dev/null +++ b/scripts/test_nightly_run_logs.sh @@ -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 ]