The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
apt repository: check the staged tree for the packages it holds
Claude1d2ed428250e
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 6523ae0e..84a2481a 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -657,20 +657,25 @@ jobs:cp "$KEYRING_ASC" dist/apt-repo/beacon-archive-keyring.asccp "$RUNNER_TEMP/beacon-archive-keyring.gpg" dist/apt-repo/beacon-archive-keyring.gpg+ # Checks what this run stages, not this tag's version: the staged pool holds only packages the+ # index lacked, which on a rerun or after a partial publish need not include this tag's own,+ # and may include backfilled releases. The check against the public URL below covers $VERSION.- name: Check the update with apt before publishingif: steps.gate.outputs.publish == 'true'- env:- VERSION: ${{ steps.gate.outputs.version }}run: |set -euo pipefail- # A rerun of a published tag stages no packages, so there is nothing local to download;- # the check against the public URL below still runs.- if [ -z "$(find dist/apt-repo/pool -name '*.deb')" ]; then- echo "::notice::$TAG is already in the apt repository; only the index is republished"+ url="file:$PWD/dist/apt-repo"+ keyring="$RUNNER_TEMP/beacon-archive-keyring.gpg"+ sh packaging/linux/apt/verify-apt-repo.sh "$url" "$keyring" -+ find dist/apt-repo/pool -name '*.deb' 2>/dev/null | sort > "$RUNNER_TEMP/staged"+ if [ ! -s "$RUNNER_TEMP/staged" ]; then+ echo "::notice::every package is already in the apt repository; only the index is republished"exit 0fi- sh packaging/linux/apt/verify-apt-repo.sh "file:$PWD/dist/apt-repo" \- "$RUNNER_TEMP/beacon-archive-keyring.gpg" "$VERSION"+ while read -r deb; do+ APT_VERIFY_ARCHES="$(dpkg-deb -f "$deb" Architecture)" \+ sh packaging/linux/apt/verify-apt-repo.sh "$url" "$keyring" "$(dpkg-deb -f "$deb" Version)" < /dev/null+ done < "$RUNNER_TEMP/staged"# Order matters: packages, then index files, then the signed Release files with InRelease# last, so no client is pointed at a file that is not there yet. Packages are immutable anddiff --git a/CLAUDE.md b/CLAUDE.mdindex 72017386..208d2454 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -303,7 +303,9 @@ A pushed `v*` tag runs the full release end-to-end viathe `apt-repository` concurrency group cancels a pending job when a third arrives; that alsorepairs an index rolled back in the bucket within the window.`verify-apt-repo.sh` runs a real, isolated `apt-get update`/`download` against the staged- tree and again against the public URL; CI's `apt-repository` job runs `test-apt-repo.sh`.+ tree (the index, then each staged package by its own version and architecture, since the+ tree holds only what the run adds) and again against the public URL for the tag's version;+ CI's `apt-repository` job runs `test-apt-repo.sh`.Upload order is pool, index, then `Release.gpg`/`Release`/`InRelease` with `Acquire-By-Hash`.Skipped with a notice until every `APT_*` setting exists, and for prerelease (`-`) tags.5. `finalize` (ubuntu, `needs` goreleaser, package and windows-package, runs whenever `goreleaser` succeeded)diff --git a/packaging/linux/apt/test-apt-repo.sh b/packaging/linux/apt/test-apt-repo.shindex c6ccff8c..eee7a1a3 100755--- a/packaging/linux/apt/test-apt-repo.sh+++ b/packaging/linux/apt/test-apt-repo.sh@@ -200,4 +200,17 @@ sh "$BUILD" --out "$work/out11" --keyring "$work/other-keyring.gpg" --signing-ke--existing "$work/existing" "$deb_a6" "$deb_b6"pass "after a rotation the old key can be removed from the committed keyring"+# 12. A staged tree holds only what a run adds, so the pre-publish check verifies the index ("-")+# and each staged package's own version and architecture, not every architecture.+existing+deb_b7="$(make_deb 1.0.6 arm64)"+sh "$BUILD" --out "$work/out12" --keyring "$work/both-keyring.gpg" --signing-key "$other_fpr" \+ --existing "$work/existing" "$deb_b7"+sh "$VERIFY" "file:$work/out12" "$work/both-keyring.gpg" - >/dev/null+APT_VERIFY_ARCHES=arm64 sh "$VERIFY" "file:$work/out12" "$work/both-keyring.gpg" 1.0.6 >/dev/null+if sh "$VERIFY" "file:$work/out12" "$work/both-keyring.gpg" 1.0.6 >/dev/null 2>&1; then+ fail "a staged tree without the amd64 package passed a check for both architectures"+fi+pass "the staged tree is checked for the packages it holds"+echo "all apt repository checks passed"diff --git a/packaging/linux/apt/verify-apt-repo.sh b/packaging/linux/apt/verify-apt-repo.shindex a8eb691c..0aeb9777 100755--- a/packaging/linux/apt/verify-apt-repo.sh+++ b/packaging/linux/apt/verify-apt-repo.sh@@ -5,6 +5,10 @@## packaging/linux/apt/verify-apt-repo.sh URL KEYRING VERSION [PACKAGE]#+# VERSION "-" checks only the signature and the index (apt-get update) and downloads nothing.+# APT_VERIFY_ARCHES limits the downloads to some of the architectures (default amd64 arm64), for a+# staged tree that holds only the packages a run adds.+## URL is the repository root (https://..., or file:/path for a staged copy). KEYRING is a binary# keyring file. Runs as an ordinary user: apt gets private state, cache and source directories and# never reads or changes the host's own configuration.@@ -23,7 +27,7 @@ url="$1"keyring="$2"version="$3"package="${4:-beacon}"-ARCHES="amd64 arm64"+ARCHES="${APT_VERIFY_ARCHES:-amd64 arm64}"[ -f "$keyring" ] || fail "keyring $keyring does not exist"keyring="$(CDPATH='' cd -- "$(dirname -- "$keyring")" && pwd)/$(basename -- "$keyring")"@@ -59,6 +63,11 @@ export APT_CONFIGapt-get --error-on=any update || fail "apt-get update against $url failed"+if [ "$version" = "-" ]; then+ echo "verify-apt-repo: $url has a valid index signed by the given key"+ exit 0+fi+for arch in $ARCHES; do(cd "$dir/download" && apt-get download "$package:$arch=$version") \|| fail "could not download $package:$arch=$version from $url"