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:
1 parent
cfde421af4
commit
91dce84b36
6 files changed
+119
-23
No files matched your search
+11
-2
@@ -45,14 +45,23 @@ 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.
|
||||
# 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: no build script,
|
||||
# procedural macro or test of the workspace runs in it. It shares the registry
|
||||
# cache with the build below, which has no ssh mount (so no agent socket and no
|
||||
# key in reach of the code it compiles and runs) and is --offline: it uses what
|
||||
# this step fetched (the registry in the cache mount, the git checkout of
|
||||
# VoelinProtocol in this step's layer) or fails.
|
||||
RUN --mount=type=ssh,required=true \
|
||||
--mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
|
||||
cargo fetch --locked
|
||||
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,id=voelin-target-linux,target=/src/target \
|
||||
cargo build --release --locked -p voelin-ui -p voelin-gateway \
|
||||
cargo build --release --locked --offline -p voelin-ui -p voelin-gateway \
|
||||
&& scripts/package.sh linux /out
|
||||
|
||||
FROM scratch AS artifacts
|
||||
|
||||
Reference in new issue
Block a user