Commit 362996c
committed
fix(container): make sqlite e2e runner work under rootless podman
Bring the SQLite end-to-end runner up against
`podman 5.8.2` / `podman-compose 1.5.0` without regressing
the Docker-Compose-v2 path. The five issues fixed here all
surface only when the harness is driven by something other
than the upstream Docker daemon, which is why they slipped
past Phase 8's bring-up against the operator workflow.
Containerfile:
- Copy `entry_script_lib_sh` into the release runtime base
alongside `entry.sh`. The file is sourced unconditionally
at start-up; without it the container exits immediately
with `can't open /usr/local/lib/torrust/entry_script_lib_sh`.
The debug runtime base already pulled it directly from the
build context — the release base routed everything via the
`runtime_assets` collector and this one path was missed.
E2E `e2e-env-up.sh` (public + private SQLite modes):
- Export `BUILDAH_FORMAT=docker` so the Containerfile's
`HEALTHCHECK` directive survives the build under podman.
The default OCI format silently drops it, leaving
`torrust-index-1` permanently un-healthy and tripping
the wait-for-healthy gate downstream.
- Pre-create the `./storage/{index,tracker}/{lib/database,log,etc}`
bind-mount sources. Docker auto-creates missing host paths;
podman does not, and combined with `:Z` SELinux relabel the
failure mode is an opaque `getxattr ... no such file or
directory` rather than the friendlier "bind source path does
not exist".
- Replace `docker compose up --pull always` with a standalone
`docker compose pull || true` followed by a plain `up`.
`podman-compose` rejects the Compose-v2 `--pull=always`
syntax (it accepts a boolean `--pull` paired with
`--pull-always`); `compose pull` works under both. The
`|| true` keeps the script resilient to transient registry
hiccups and to images that only exist locally
(e.g. `localhost/torrust_index`).
E2E `run-e2e-tests.sh`:
- Guard against being run outside the repo root: require a
git checkout, refuse if `pwd` is not the toplevel, and
identify the repo by `Cargo.toml` package name rather than
remote URL so forks and renamed clones still work. The
script does destructive things (`rm -rf ./storage`,
overwrites `.env`) that are only safe inside the project
root.
- Prepend `$HOME/.cargo/bin` to `PATH` so rustup-managed
toolchains are visible regardless of the invoking shell's
setup. `~/.cargo/env` is only sourced in interactive login
shells, which CI runners and `bash -c` invocations are not.
- Wipe `./storage` before each run, routing through
`podman unshare rm -rf` when the active engine is podman.
Files written from inside a rootless container are owned by
a sub-UID from `/etc/subuid`, which a host-side `rm -rf`
cannot remove. The engine is detected via
`docker --version | grep -qi podman` so the `podman-docker`
shim is handled correctly.
- Skip `cargo install imdl` when `imdl` is already on PATH,
and pass `--locked` when it is not — the install dominated
the script's wall-clock time on every re-run.
- Probe whether containers come up named with `-` (Compose v2)
or `_` (podman-compose v1.x) and compose the
`wait_for_container_to_be_healthy.sh` arguments from the
detected separator. The probe runs once per phase and
defaults to `-` when nothing matches.
`wait_for_container_to_be_healthy.sh`:
- Treat a `null` `.State.Health` (image declares no
`HEALTHCHECK`) the same as `{}` and fall back to the plain
`.State.Status == "running"` check. Without this the loop
spins until the retry budget runs out for any image without
a healthcheck — common for upstream images such as
`docker.io/torrust/tracker`, and for any locally-built image
whose layers ended up in OCI format.
No changes to the application or to the production compose
flow; this is purely the e2e-harness portability fix that
unblocks the SQLite suite under podman.1 parent b79e32d commit 362996c
5 files changed
Lines changed: 162 additions & 10 deletions
File tree
- contrib/dev-tools/container
- e2e/sqlite
- mode
- private
- public
- functions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
261 | 268 | | |
262 | 269 | | |
263 | 270 | | |
| |||
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
3 | 17 | | |
4 | 18 | | |
5 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
6 | 24 | | |
7 | 25 | | |
8 | 26 | | |
| |||
13 | 31 | | |
14 | 32 | | |
15 | 33 | | |
16 | | - | |
| 34 | + | |
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
3 | 25 | | |
4 | 26 | | |
5 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
6 | 37 | | |
7 | 38 | | |
8 | 39 | | |
| |||
13 | 44 | | |
14 | 45 | | |
15 | 46 | | |
16 | | - | |
| 47 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
3 | 28 | | |
4 | 29 | | |
5 | 30 | | |
6 | 31 | | |
7 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
8 | 48 | | |
9 | 49 | | |
10 | 50 | | |
11 | 51 | | |
12 | 52 | | |
13 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
14 | 75 | | |
15 | 76 | | |
16 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
17 | 81 | | |
18 | 82 | | |
19 | 83 | | |
20 | 84 | | |
21 | 85 | | |
22 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
23 | 103 | | |
24 | 104 | | |
25 | 105 | | |
| |||
29 | 109 | | |
30 | 110 | | |
31 | 111 | | |
| 112 | + | |
| 113 | + | |
32 | 114 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
36 | 118 | | |
37 | 119 | | |
38 | 120 | | |
| |||
63 | 145 | | |
64 | 146 | | |
65 | 147 | | |
| 148 | + | |
| 149 | + | |
66 | 150 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
70 | 154 | | |
71 | 155 | | |
72 | 156 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
17 | 29 | | |
18 | 30 | | |
19 | 31 | | |
| |||
0 commit comments