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
@@ -17,13 +17,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends cmake git libas
|
||||
# `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, although this crate does not use
|
||||
# voelin-identity.
|
||||
# the first cargo command needs this, although this crate does not use
|
||||
# voelin-identity: 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. The build below has no
|
||||
# ssh mount (so no agent socket and no key in reach of the code it compiles and
|
||||
# runs) and is --offline, so it uses what this step fetched or fails.
|
||||
RUN --mount=type=ssh,required=true \
|
||||
cargo build --release --locked -p voelin-gateway && cp target/release/tsgw /tsgw && mkdir /data
|
||||
cargo fetch --locked
|
||||
RUN cargo build --release --locked --offline -p voelin-gateway && cp target/release/tsgw /tsgw && mkdir /data
|
||||
|
||||
FROM gcr.io/distroless/cc-debian12:nonroot
|
||||
COPY --from=build /tsgw /usr/local/bin/tsgw
|
||||
|
||||
Reference in new issue
Block a user