Repository navigation
fix(sysext): guard SHA256SUMS writes with ETags and add opt-in retention - #104
Conversation
Two publishers of one bucket (the trixie and forky sysext builds) restore, merge and write back the same ext/<name>/SHA256SUMS. The write had no condition, so the later run dropped the entries of the earlier one. - sync-sysext-metadata.sh restores ext/ and records the ETag of each SHA256SUMS and SHA256SUMS.gpg it downloaded with get-object. - upload-to-r2.sh, with METADATA_ETAGS set (sysext only), writes each changed manifest and then its signature with --if-match on that ETag, or --if-none-match '*' for a new one; a 412 fails the run before any other manifest or index. Other package types upload as before. - --sysext-keep-versions N (default 0, nothing pruned) keeps the newest N versions per name, OS version and arch, in systemd-sysupdate version order, and --pruned-report lists the dropped payloads. - delete-pruned-payloads.sh deletes a pruned payload only after the upload and only when the live SHA256SUMS no longer lists it. Refs #102
Publishers of one bucket must still serialize; the conditional write turns an unserialized race into a failed run. Nothing is pruned by default. Refs #102
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…2 as a conflict - sync-sysext-metadata.sh no longer creates an empty ext/: the generator reads an existing ext/ strictly and failed a first publish with "no existing sysext packages found". An ext/ with any restored file stays, so a malformed published repository still fails closed. - upload-to-r2.sh compares the object with the local bytes only after an ambiguous attempt (no response or another error). A 412 on the first attempt is a conflict even over identical bytes, so no signature follows it. - compareVersions has no shortcut for an empty string, like upstream systemd; tests pin systemd's documented order and its edge cases. Refs #102
…ule (ADR-0019) Refs #102
Cross-review record
Revert testIn a scratch worktree from the head, the 2 scripts and LimitsNo test against real R2. The fake |
* ci(build): move the sysext publish to repogen v0.7.4 repogen v0.7.4 writes each ext/<name>/SHA256SUMS and SHA256SUMS.gpg only when its ETag is unchanged since the metadata restore (repogen ADR-0019, frostyard/repogen#104), so a concurrent writer fails the run with a 412 instead of losing manifest entries. Both publish steps (build and build-forky) move the action pin, repogen-version and repogen-commit together to the peeled v0.7.4 commit. sysext-keep-versions stays unset: its default 0 keeps every published version. The forky job comment and the sysexts and CI/CD design docs now describe the guard and why the two publish jobs must stay serialized. * docs(sysexts): state what a Phase 3b conflict leaves written Phase 3b writes 1 extension at a time, so a 412 keeps the manifests written before it and can leave a SHA256SUMS and its signature out of step (repogen ADR-0019). --------- Co-authored-by: frostyard-machines <[email protected]>
Summary
Closes #102.
snosi will publish the sysexts of 2 Debian suites (
_13_trixie,_14_forky) into the sameext/<name>/with 1SHA256SUMS(core Plan 0009 Phase 6). This PR closes the 2 gaps of #102. The decision is recorded in ADR-0019.scripts/sync-sysext-metadata.shrestoresext/<name>/SHA256SUMSandSHA256SUMS.gpgwithaws s3api get-objectand records the ETag of exactly the bytes it wrote (never an ETag read after the download).scripts/upload-to-r2.shphase 3b writes each changed manifest, then its signature, with--if-match <etag>, or--if-none-match '*'for a new file. R2 evaluates these headers atomically on PutObject (R2 S3 API, conditional operations). A 412 stops the run with::error::; no metadata of the run replaces the other publisher's. An unchanged manifest is not written. An aws CLI without the flags fails loud; it never writes without the condition. ADR-0017's order stays: payloads, metadata, guarded manifests, indexes.ext/indexis not guarded.sysext-keep-versions(CLI--sysext-keep-versions,--pruned-report).0(the default) keeps every version: nothing is pruned, as today. With N > 0,SHA256SUMSkeeps the newest N versions per (name, OS version, arch), in systemd-sysupdate's version order (a port ofstrverscmp_improved()), so trixie files never push forky files out. A new last step deletes a pruned payload only after the upload and the cache purge succeeded, and only when the liveSHA256SUMSno longer lists it.Other package types upload exactly as before (
METADATA_ETAGSunset).Checks
make check— greenmake ci— CI run below (the Docker package build is not run locally)make test-unitgreen; integration unchanged by this PRRisk tier
Rationale: the PR touches publication paths in
.github/risk-paths.json:.github/actions/publish-to-r2/**(L1): the sync step calls the new restore script, the upload step setsMETADATA_ETAGSfor sysext only, and 1 new step deletes pruned payloads. Safe: other package types are unchanged (TestUploadWithoutGuardKeepsOtherPackageTypesUnchanged); the delete step runs only whensysext-keep-versionsis not0and every earlier step passed.scripts/upload-to-r2.sh,scripts/sync-sysext-metadata.sh,scripts/delete-pruned-payloads.sh(L1): the write guard and the delete. Safe: a malformed state file, a missing signature beside a published one, a deeper path, or an old aws CLI all fail before or instead of an unconditional write; the delete re-reads the live manifest and refuses a listed file.internal/generator/sysext/**,internal/cli/generate.go(L1): retention. Safe: default0prunes nothing (TestRetentionOffKeepsEveryVersion,TestGenerateSysextKeepVersionsDefaultPrunesNothing); signing is unchanged..github/risk-paths.json(L2): adds the 2 new scripts at L1.internal/releaseasset/**(L2): new contract tests only.Docs housekeeping
TEMPLATE.md, indexed indocs/README.mddocs/design/ci-cd.md,docs/guides/publish-to-r2.md,docs/guides/usage.md,docs/specs/generators.md,AGENTS.md,README.mdupdatedVerification
node scripts/check-docs.mjsgreen (31 docs, 305 links)make lint: 0 issues;go test ./...green;shellcheck scripts/*.shcleanTestSyncSysextMetadata*(2),TestUploadGuard*(8),TestDeletePrunedPayloads*(4),TestPublishActionGuardsSysextMetadataAndPrunesLast; with retention removed:TestRetentionKeepsNewestVersionPerOSVersion,TestRetentionDropsIncomingVersionOlderThanKept,TestRetentionKeepsTwoNewest,TestGenerateSysextKeepVersionsWritesPrunedReport.awsfollows R2's documented 412 behavior; the first real sysext publish after merge is the live check.