From b8ba43f0c98a83ba4e31bef100e632f4224d92ad Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 14:24:19 +0300 Subject: [PATCH] Check each OpenSSH tool on its own and stop only an agent this job started command -v with two names returns 0 when one resolves, so the guards were weaker than they read. The release workflow's final step killed whatever agent SSH_AGENT_PID named; it now needs the marker the start step writes after it succeeded. Two documentation lines re-wrapped (the review's three minors). Co-Authored-By: Claude Fable 5.1 --- .gitea/actions/checks/action.yml | 10 ++++++---- .gitea/workflows/release.yml | 8 ++++++-- docs/building.md | 3 ++- docs/ci.md | 5 +++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitea/actions/checks/action.yml b/.gitea/actions/checks/action.yml index a01e6c5..92a8b82 100644 --- a/.gitea/actions/checks/action.yml +++ b/.gitea/actions/checks/action.yml @@ -26,10 +26,12 @@ runs: echo "::error::The VoelinProtocol deploy key is empty. Set the repository secret VOELIN_PROTOCOL_DEPLOY_KEY to the private key of the read-only deploy key on Voelin/VoelinProtocol (docs/ci.md, VoelinProtocol access). Pull requests from forks get no secrets." >&2 exit 1 fi - command -v ssh ssh-keygen > /dev/null || { - echo "::error::The job image needs the OpenSSH client (ssh, ssh-keygen)." >&2 - exit 1 - } + for tool in ssh ssh-keygen; do + command -v "$tool" > /dev/null || { + echo "::error::The job image needs the OpenSSH client: $tool is missing." >&2 + exit 1 + } + done ssh_dir="$HOME/.ssh" key_file="$ssh_dir/voelin_protocol" mkdir -p "$ssh_dir" diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 1bf5c2a..928f3ab 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -46,7 +46,9 @@ jobs: echo "::error::The repository secret VOELIN_PROTOCOL_DEPLOY_KEY is missing or empty. It holds the private key of the read-only deploy key on Voelin/VoelinProtocol (docs/ci.md, VoelinProtocol access)." >&2 exit 1 fi - command -v ssh-agent ssh-add > /dev/null + for tool in ssh-agent ssh-add; do + command -v "$tool" > /dev/null || { echo "::error::The runner needs the OpenSSH client: $tool is missing." >&2; exit 1; } + done eval "$(ssh-agent -s -t 32400)" > /dev/null started= trap '[[ -n "$started" ]] || ssh-agent -k > /dev/null' EXIT @@ -58,6 +60,8 @@ jobs: { echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" echo "SSH_AGENT_PID=$SSH_AGENT_PID" + # Only an agent this job started is stopped at the end. + echo "VOELIN_AGENT_STARTED=1" } >> "$GITHUB_ENV" started=1 - name: Linux packages @@ -135,6 +139,6 @@ jobs: - name: Stop the ssh-agent if: always() run: | - if [[ -n "${SSH_AGENT_PID:-}" ]]; then + if [[ -n "${VOELIN_AGENT_STARTED:-}" && -n "${SSH_AGENT_PID:-}" ]]; then ssh-agent -k > /dev/null || true fi diff --git a/docs/building.md b/docs/building.md index c2d6707..8c3cdb0 100644 --- a/docs/building.md +++ b/docs/building.md @@ -81,7 +81,8 @@ scripts/docker-build.sh android # → dist/android/ scripts/docker-build.sh # all three ``` -The same with plain Docker, e.g. `docker build --ssh default -f docker/linux.Dockerfile -o dist/linux .` +The same with plain Docker, e.g. `docker build --ssh default -f docker/linux.Dockerfile -o dist/linux .`. + **The builds need an ssh-agent that holds a key able to read the private VoelinProtocol repository** ([below](#depending-on-voelinprotocol)): Cargo fetches it inside the image, through the agent that `--ssh default` hands to the diff --git a/docs/ci.md b/docs/ci.md index 248e525..61871e7 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -206,8 +206,9 @@ voelin-release:host ``` Provision Bash, Git, the OpenSSH client (`ssh-agent` and `ssh-add`), Node.js -20+, Python 3.11+, curl, tar, gzip and rootful Docker 23+ with BuildKit. Use **act_runner 0.2.7 or newer** (prefer the latest -maintained release), or gitea-runner 2+. Older act_runner does not provide +20+, Python 3.11+, curl, tar, gzip and rootful Docker 23+ with BuildKit. Use +**act_runner 0.2.7 or newer** (prefer the latest maintained release), or +gitea-runner 2+. Older act_runner does not provide `ACTIONS_RESULTS_URL`, which the pinned artifact action needs. Register the runner against `https://git.faumaray.ru`, reachable from both the host and build containers. Gitea 1.25.4 provides the required artifact-v4 API.