release and the images: the agent only for cargo fetch, stopped after the builds, never on a runner that may print the key

release.yml checks the runner version before any step names the secret (same
gate as ci.yml), starts the ssh-agent only on the positive flag, and stops it in
an always() step right after the last build, so the artifact upload and the
release draft have neither the key nor the socket. The four Dockerfiles (linux,
windows, android, the gateway image) give the agent to `RUN cargo fetch --locked`
only; the build after it has no ssh mount and is offline (--offline, and
CARGO_NET_OFFLINE for the Android Gradle task, which starts cargo-ndk).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-28 02:55:23 +03:00
1 parent cfde421af4
commit 91dce84b36
6 files changed
+119 -23

No files matched your search

+15 -2
View File
@@ -90,13 +90,26 @@ WORKDIR /src
# `docker build --ssh default` forwards (scripts/docker-build.sh passes it):
# the key stays in the agent and never reaches a layer. The host key is the
# reviewed line from .gitea/known_hosts. Cargo resolves the whole workspace, so
# every cargo command needs this (Gradle's cargo-ndk inherits the agent and the
# variable below).
# the first cargo command needs this: the `cargo fetch` below, the only step
# that is given the agent.
COPY .gitea/known_hosts /etc/ssh/ssh_known_hosts
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
# Only this step is given the agent, and it only fetches (the packages of every
# target, so the Android ones too): no build script, procedural macro or test of
# the workspace runs in it. The build below has no ssh mount (so no agent socket
# and no key in reach of the code it compiles and runs).
RUN --mount=type=ssh,required=true \
--mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
cargo fetch --locked
# Gradle starts cargo-ndk, which starts cargo: the variable makes every one of
# them offline, as `--offline` does for the other Dockerfiles (the Gradle task
# is left as it is, because a developer's own build has network and no
# `cargo fetch`). The build uses what the step above fetched (the registry in
# the cache mount shared with it, the git checkout of VoelinProtocol in its
# layer) or fails.
ENV CARGO_NET_OFFLINE=true
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=voelin-target-android,target=/src/target \
--mount=type=cache,id=voelin-gradle,target=/root/.gradle \
--mount=type=secret,id=keystore,required=false \