Releases for cnx01: every push to main becomes a signed release
CI / secret scan (push) Successful in 5s
CI / fmt, clippy, tests (push) Successful in 35s
CI / release (push) Skipped

As thukthuk and lampbench-web: once the checks pass on a push to main, the
CI job `release` reserves the next CalVer version (YYYY.M.MICRO, Bangkok
time) with a draft release, builds the server on Ubuntu 22.04 (glibc 2.35)
with that version and the commit (`VISA_COMMIT`), packs bin/visa, VERSION
and COMMIT as visa-linux-x86_64.tar.gz, signs it with the repository secret
RELEASE_SIGNING_KEY (ssh-keygen, namespace visa-release, principal visa-ci;
checked against release/allowed-signers before it is published) and
publishes the release. cnx01 will install a release only with that
signature (cnx-network-clan modules/visa, in a PR of its own).

- .gitea/scripts/release.py and test_release.py from lamp-testbench (the
  same reserve/publish/discard and version order), with visa's one archive;
  sign-release.sh; build-release.sh. The release scripts' tests run in the
  check job.
- `visa --version` (and `visa version`): "visa <version> (<commit>)", which
  CI and cnx01's fetch check.
- The key was made locally, put into the secret through the API and
  deleted; only its public half is in the repo.
- README, AGENTS (main is live: push only whole steps), PLAN's decisions.

Checks: fmt, clippy; test_release.py 14 tests OK in WSL; `visa --version`.
This commit is contained in:
grabowski committed 2026-11-20 17:06:14 +07:00
1 parent 1f54d93643
commit 0d3b2d8b84
10 files changed
+866 -9

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# CI, job `release`: sign the server's archive, which cnx01 installs only
# with this signature (cnx-network-clan modules/visa). The key is the
# repository secret RELEASE_SIGNING_KEY, the base64 of an OpenSSH ed25519
# key that exists nowhere else; its public half is release/allowed-signers
# (principal visa-ci, namespace visa-release), the same line as the fleet's
# modules/visa/allowed-signers: change both together. The signature is
# checked against that file before it is published, so a secret that does
# not match fails the release here instead of on cnx01.
# RELEASE_SIGNING_KEY=... bash .gitea/scripts/sign-release.sh dist/visa-linux-x86_64.tar.gz
# SIGNERS names another allowed-signers file (the tests).
set -euo pipefail
file=${1:?the archive to sign}
signers=${SIGNERS:-release/allowed-signers}
if [ -z "${RELEASE_SIGNING_KEY:-}" ]; then
echo "the repository secret RELEASE_SIGNING_KEY is not set: no signed release for cnx01" >&2
exit 1
fi
key=$(mktemp)
trap 'rm -f "$key"' EXIT
printf '%s' "$RELEASE_SIGNING_KEY" | base64 -d >"$key"
rm -f "$file.sig"
ssh-keygen -q -Y sign -n visa-release -f "$key" "$file"
ssh-keygen -Y verify -f "$signers" -I visa-ci -n visa-release -s "$file.sig" <"$file"