Make the documented image run start cargo, and its VoelinProtocol mirror work
The docker run that docs/ci.md prints for the tests under the job image hung for ever once the apt and rustup setup was done: bash -c execs its last command, so xvfb-run became the container's process 1 and never started cargo (probed: with the runner image and xvfb installed, xvfb-run -a as process 1 stays up with an idle Xvfb, and the same command under --init finishes). The command now has --init. The runner is not affected: it starts its steps with docker exec. The hint for the private dependency is part of the block now, so the block runs as printed: the bare clone is mounted at /protocol.git (it was never mounted into the container before) and `git config` runs with -C /, because a git worktree's .git file points outside the /src mount and git config in /src exits 128 with "gitfile does not point to a valid repository". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8541d7c9e5
commit
cd08498092
1 file changed
+20
-6
+20
-6
@@ -112,12 +112,17 @@ check a change to the tests the way CI runs them, with every failing test of
|
||||
every crate listed in one go (`--no-fail-fast`):
|
||||
|
||||
```sh
|
||||
# A bare clone of the private VoelinProtocol repository (see below the block).
|
||||
: "${PROTOCOL_GIT:?path of a bare clone of VoelinProtocol}"
|
||||
# Root owns what the container writes: keep it in a directory of its own.
|
||||
mkdir -p .scratch
|
||||
docker run --rm -v "$PWD":/src -w /src -e HOME=/root \
|
||||
docker run --rm --init -v "$PWD":/src -w /src -e HOME=/root \
|
||||
-v "$PROTOCOL_GIT":/protocol.git:ro -e CARGO_NET_GIT_FETCH_WITH_CLI=true \
|
||||
-e CARGO_HOME=/src/.scratch/cargo -e RUSTUP_HOME=/src/.scratch/rustup \
|
||||
-e CARGO_TARGET_DIR=/src/.scratch/target \
|
||||
docker.gitea.com/runner-images:ubuntu-24.04 bash -c '
|
||||
git -C / config --global url."file:///protocol.git".insteadOf \
|
||||
ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential ca-certificates cmake curl git jq pkg-config python3 \
|
||||
libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev \
|
||||
@@ -129,12 +134,21 @@ docker run --rm -v "$PWD":/src -w /src -e HOME=/root \
|
||||
cargo test --workspace --locked --no-fail-fast"'
|
||||
```
|
||||
|
||||
`--init` is required: `bash -c` runs its last command, `xvfb-run`, as the
|
||||
container's process 1, and that never gets to start `cargo` (the command
|
||||
hangs). The runner starts its steps with `docker exec` in a container whose
|
||||
process 1 is something else, so CI itself is not affected.
|
||||
|
||||
The private VoelinProtocol dependency needs the deploy key
|
||||
([below](#voelinprotocol-access)); without it, point git at a local bare
|
||||
clone of that repository with
|
||||
`git config --global url."file:///path/to/VoelinProtocol.git".insteadOf
|
||||
ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git` and
|
||||
`CARGO_NET_GIT_FETCH_WITH_CLI=true`, which leaves `Cargo.lock` as it is.
|
||||
([below](#voelinprotocol-access)). The block reads it from a local bare clone
|
||||
instead: `PROTOCOL_GIT` is mounted at `/protocol.git` and git is told to use
|
||||
it in place of the SSH URL (with `CARGO_NET_GIT_FETCH_WITH_CLI=true`, as in CI,
|
||||
so that cargo runs the `git` command), which leaves `Cargo.lock` as it is.
|
||||
The `git config` is run with `-C /` because a git worktree's `.git` file points
|
||||
outside the mount, and `git config` in `/src` then fails with `fatal: gitfile
|
||||
does not point to a valid repository`. To use the deploy key instead, set it up
|
||||
as described below and leave out the `PROTOCOL_GIT` lines and the `git config`
|
||||
command.
|
||||
|
||||
What the image lacks, and what the tests do about it. A test that is about
|
||||
the missing piece prints `skipped: <the piece>` (or is `#[ignore]`d with the
|
||||
|
||||
Reference in new issue
Block a user