Document how CI and the release builds read the private VoelinProtocol repository

docs/ci.md gets a "VoelinProtocol access" section: why every cargo command
needs the access (Cargo resolves the whole workspace, so the gateway image
needs it too), the deploy key and the repository secret
VOELIN_PROTOCOL_DEPLOY_KEY, what the checks action, the release workflow and
the Dockerfiles do with it, why Cargo is told to use the system git, the
committed host key line with its fingerprint and the two commands that
re-check it, the effect on fork pull requests, and what each failure message
means. The runner setup no longer says that a fresh checkout does not build
there. docs/building.md says that the Docker builds need an ssh-agent with a
key that can read VoelinProtocol (--ssh default) and summarises the CI setup;
the plain docker build commands in it and in docs/gateway-admin.md gain
--ssh default, without which they would now stop at the cargo step.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-24 13:44:44 +03:00
1 parent b89116c0f4
commit 6e774873bf
3 files changed
+129 -20

No files matched your search

+26 -8
View File
@@ -28,7 +28,8 @@ yet: Windows SmartScreen warns about the installer, and the debug APK is
signed with a debug key (fine for testing, not for the Play Store).
The gateway's image can also be built directly:
`docker build -f crates/voelin-gateway/Dockerfile -t tsgw .`.
`docker build --ssh default -f crates/voelin-gateway/Dockerfile -t tsgw .`
(`--ssh default`: see [Locally with Docker](#locally-with-docker)).
Gitea at [git.faumaray.ru](https://git.faumaray.ru) builds the same package
types through `.gitea/workflows/release.yml`: manual runs produce one
@@ -80,7 +81,15 @@ scripts/docker-build.sh android # → dist/android/
scripts/docker-build.sh # all three
```
The same with plain Docker, e.g. `docker build -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
build. The key stays in the agent; it is not copied into the image or the build
cache. `scripts/docker-build.sh` passes `--ssh default` itself and stops with a
message when `ssh-add -l` shows no agent or no key (`eval "$(ssh-agent -s)"`,
then `ssh-add` your key). The server's host key comes from
`.gitea/known_hosts` ([ci.md](ci.md#voelinprotocol-access)).
Rebuilds are incremental: the cargo registry, `target/` and Gradle live in
BuildKit cache mounts (`docker builder prune` frees them).
@@ -148,13 +157,22 @@ set `net.git-fetch-with-cli = true` in `~/.cargo/config.toml`.
compiler (gcc or clang) and cmake.
`deny.toml` allows this one git source.
**CI and the Docker builds need read access to that repository too**: an SSH
deploy key (a repository secret written to `~/.ssh`, with the server's host key
in `known_hosts`) or an access token (rewrite the SSH URL to HTTPS with
**CI and the Docker builds read it with a read-only SSH deploy key.** The key
is registered on VoelinProtocol and stored as the repository secret
`VOELIN_PROTOCOL_DEPLOY_KEY`; the Gitea workflows write it to `~/.ssh` (CI) or
load it into an ssh-agent (release builds), the server's host key comes from the
committed `.gitea/known_hosts`, and Cargo is told to fetch with the system git
(`CARGO_NET_GIT_FETCH_WITH_CLI=true`) because its built-in git client ignores
`~/.ssh/config`. The Docker builds use the same key through
`docker build --ssh default` (see above). What was set up, how to re-check the
host key's fingerprint and what each failure means:
[ci.md](ci.md#voelinprotocol-access). A runner of your own gets the same setup
from the workflows; the alternative to a deploy key is an access token (rewrite
the SSH URL to HTTPS with
`git config --global url."https://<token>@git.faumaray.com/".insteadOf ssh://gitea@git.faumaray.com/`
and set `CARGO_NET_GIT_FETCH_WITH_CLI=true`). Without it `cargo` cannot fetch
the dependency and a fresh checkout does not build; the details are in
VoelinProtocol's `docs/development.md` ("Depending on VoelinProtocol").
and set `CARGO_NET_GIT_FETCH_WITH_CLI=true`), which these workflows do not
use. More in VoelinProtocol's `docs/development.md` ("Depending on
VoelinProtocol").
### Working with a sibling VoelinProtocol checkout
+102 -11
View File
@@ -51,16 +51,17 @@ the separate `release.yml` workflow below.
Configure this in the runner's labels when registering/configuring it;
an `ubuntu-latest` label alone does not match. The job image must provide
Bash, Git, Node.js for checkout v4, and root or passwordless sudo for apt.
Bash, Git, the OpenSSH client, Node.js for checkout v4, and root or
passwordless sudo for apt.
3. Allow network access from the runner and job container to the Gitea
instance, GitHub (checkout action, dependencies and RustSec advisories),
GHCR (runner image), Ubuntu apt mirrors, rustup distribution servers,
crates.io and dependency/license sources used by cargo-about. The
workspace also depends on the **private** VoelinProtocol repository
(`voelin-identity`, over SSH), so the job needs read access to it: an SSH
deploy key or an access token, set up as in
[building.md](building.md#depending-on-voelinprotocol). Until a runner has
it, a fresh checkout does not build there.
(`voelin-identity`, over SSH), so the job needs read access to it and the
server's SSH port. The workflows set that up themselves from a repository
secret: [VoelinProtocol access](#voelinprotocol-access). A runner needs
nothing for it beyond the network access and the image tools above.
4. Provision enough RAM, swap and free disk for a full Slint workspace build
plus cargo-deny/cargo-about compilation. These are large builds; monitor
the first run and size the runner accordingly. The workflow limits Cargo
@@ -93,14 +94,103 @@ No GitHub cache/artifact service or reusable-workflow support is required.
The job does not need a Docker socket mounted inside its container; the
runner itself still needs Docker access to start that container. Keep this
runner isolated from production services and credentials, particularly when
accepting untrusted pull requests. No release signing or publishing secrets
are needed.
accepting untrusted pull requests. CI needs one secret, the VoelinProtocol
deploy key below; it needs no release signing or publishing secrets.
After registering the runner, dispatch **CI** in Gitea Actions and inspect
all step results. Local YAML/shell checks do not prove that a particular
Gitea instance, runner registration, network policy or resource allocation
can complete this job.
### VoelinProtocol access
The workspace depends on `voelin-identity` from the **private** repository
`Voelin/VoelinProtocol`, as a git dependency over SSH
([building.md](building.md#depending-on-voelinprotocol)). Cargo resolves the
whole workspace before it builds anything, so *every* cargo command needs
that access: all of CI, all three package images and the gateway image (whose
crate does not use `voelin-identity` itself). Without it the first cargo
command fails with `unknown SSH host key` (runs 1037 and 1050 did).
What is set up:
- **The deploy key.** A read-only SSH deploy key is registered on
`Voelin/VoelinProtocol` (Settings → Deploy Keys, write access off). It has
no other use and no access to any other repository. Its private half is the
repository secret **`VOELIN_PROTOCOL_DEPLOY_KEY`** of `Voelin/VoelinClient`
(Settings → Actions → Secrets): the whole OpenSSH private key file, BEGIN
and END lines included, without a passphrase. To rotate it, make a new pair
(`ssh-keygen -t ed25519 -N '' -C voelin-client-ci -f key`), register
`key.pub` on VoelinProtocol, replace the secret with the contents of
`key`, run CI, then delete the old deploy key and `key`.
- **CI** (`ci.yml`). The workflow hands the secret to the checks action as its
input `protocol-deploy-key` (a repository secret is not visible inside a
composite action). The action's first step fails at once, naming the secret,
if the input is empty or is not a private key. Otherwise it writes the key to
`~/.ssh/voelin_protocol` (mode 0600, `~/.ssh` 0700), appends the host key
line to `~/.ssh/known_hosts`, writes a `Host git.faumaray.com` block to
`~/.ssh/config` (`User gitea`, that `IdentityFile`, `IdentitiesOnly yes`,
`StrictHostKeyChecking yes`) and exports `CARGO_NET_GIT_FETCH_WITH_CLI=true`
and `GIT_SSH_COMMAND` for the rest of the job. It prints only the key's
public fingerprint; the key is never echoed. After the system packages a
second step runs `git ls-remote` on VoelinProtocol, so a wrong key or host
key fails there, with the reason, and not inside a cargo command. The key
lives in the job container and goes with it.
- **Release** (`release.yml`). A step after checkout starts an `ssh-agent` on
the release host, loads the key into it from stdin (it is never written to
disk) and exports `SSH_AUTH_SOCK`; the agent forgets the key after nine
hours, and a last step, which also runs after a failure, stops it. The
builds pass the agent on with `docker build --ssh default`
(`scripts/docker-build.sh` does it for the three packages; the gateway image
step does it itself).
- **The images.** Each cargo `RUN` of `docker/*.Dockerfile` and
`crates/voelin-gateway/Dockerfile` has `--mount=type=ssh,required=true`, so
the key exists only inside that step, through the agent socket, and never
reaches a layer, a build argument or the cache; a build without `--ssh`
stops there with `unset ssh forward key default`. The build stage copies
`.gitea/known_hosts` to `/etc/ssh/ssh_known_hosts` and sets the same
`CARGO_NET_GIT_FETCH_WITH_CLI=true`; the toolchain stages install `git` and
`openssh-client`.
- **Cargo uses the system git** (`CARGO_NET_GIT_FETCH_WITH_CLI=true`) because
Cargo's built-in git client does not read `~/.ssh/config` (so it cannot use
an `IdentityFile`), authenticates with an ssh-agent and checks the host
against `~/.ssh/known_hosts` and its own `net.ssh.known-hosts` setting. The
system git runs `ssh`, which reads the config above (and
`/etc/ssh/ssh_known_hosts` in the images), so the same files serve a plain
`git` call, Cargo and the access check.
- **The host key** is committed in [`.gitea/known_hosts`](../.gitea/known_hosts),
never fetched while a job runs. Gitea's built-in SSH server (`SSH-2.0-Go`)
offers an RSA host key only (`ssh-keyscan -t ed25519 git.faumaray.com`
prints nothing), so the line is `ssh-rsa`; its fingerprint is
`SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A`. Re-check it:
```sh
ssh-keygen -lf .gitea/known_hosts # the committed line
ssh-keyscan -t rsa git.faumaray.com | ssh-keygen -lf - # what the server offers now
```
Both print the fingerprint above. If the server's key is ever replaced on
purpose, confirm the new fingerprint with the server's administrator, put the
new `ssh-keyscan -t rsa` line and the date in `.gitea/known_hosts` and the
fingerprint here, and commit all of it in one change. Until then a changed key
makes every job stop with `Host key verification failed`, which is the point.
Pull requests from forks get no secrets: their CI run stops at the first step
with the message about the empty deploy key. Anyone who can change a workflow of
this repository, or run code in one of its jobs, can read the key; it can only
read VoelinProtocol, and it is replaced as above. That is one more reason to
keep the CI runner isolated, as said above.
If a run fails here:
| Message | Cause |
|---|---|
| `The VoelinProtocol deploy key is empty` | the secret is missing, empty or not visible (a fork's pull request) |
| `… is not an unencrypted OpenSSH or PEM private key` | the secret holds something else, or a key with a passphrase |
| `Permission denied (publickey)` in "Check read access to VoelinProtocol" | the key is valid but is not a deploy key of VoelinProtocol: compare the fingerprint "Deploy key installed" printed with the one in VoelinProtocol's deploy key settings |
| `Host key verification failed` | `.gitea/known_hosts` does not match the server: check as above before changing anything |
| `unset ssh forward key default` | a Docker build ran without `--ssh default`: a plain `docker build` (`scripts/docker-build.sh` passes it itself and stops earlier when the agent has no key) |
### Gitea release runner
The instance at `https://git.faumaray.ru` reported Gitea **1.25.4** on
@@ -114,8 +204,8 @@ host** runner with the label:
voelin-release:host
```
Provision Bash, Git, 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
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
`ACTIONS_RESULTS_URL`, which the pinned artifact action needs. Register the
runner against `https://git.faumaray.ru`, reachable from both the host and
@@ -158,8 +248,9 @@ ENDLESS_TASK_TIMEOUT = 9h
Keep sufficient RAM/swap and free disk for all package builds and their
Docker caches. The package builds run one after another, each with as many
Cargo jobs as the host has CPUs. The workflow never prunes shared Docker
state or creates host swap. The token and optional Android signing secrets
are documented in
state or creates host swap. The secrets are the VoelinProtocol deploy key
([below](#voelinprotocol-access)), `RELEASE_TOKEN` and the optional Android
signing secrets, both documented in
[Gitea releases](release.md#gitea-releases).
The Gitea release job builds packages only: it runs no formatting, Clippy,
+1 -1
View File
@@ -240,7 +240,7 @@ the unit to `/etc/systemd/system/`.
**Container** (`tsgw-image.tar.gz`, or build it):
```sh
docker load -i tsgw-image.tar.gz # or: docker build -f crates/voelin-gateway/Dockerfile -t tsgw .
docker load -i tsgw-image.tar.gz # or: docker build --ssh default -f crates/voelin-gateway/Dockerfile -t tsgw .
docker run -d --name tsgw --init --restart unless-stopped \
-v $PWD/tsgw.toml:/etc/tsgw/tsgw.toml:ro -v tsgw-data:/var/lib/tsgw \
-e TSGW_QUERY_PASSWORD=… -p 7788:7788 tsgw