Skip to content

Commit 9ddc6d7

Browse files
authored
Merge pull request #87 from LockInTime/t3code/rootless-evidence
fix(test): hand E2E evidence back to the right user under rootless Docker
2 parents f40be50 + 690d19c commit 9ddc6d7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Platform notes:
4343
- **Linux** builds need only Docker: `pnpm build:linux` compiles inside
4444
`swift:6.1-bookworm` and emits a tarball. Chromium must be non-Snap —
4545
the runtime rejects Snap launchers before starting, by design.
46+
- **Rootless Docker works**, including the E2E: Chromium's nested namespace
47+
sandbox runs fine, and the harness detects the daemon mode so exported QA
48+
evidence comes back owned by you. Nothing binds a host port, so the suites
49+
cannot collide with other services on a shared machine.
4650
- `pnpm test:e2e:mac` opens real windows and mutates `com.headless.app` user
4751
defaults. Don't run it in a background session or on a machine where that
4852
matters.

‎apps/headless/Tests/linux-docker.sh‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ EVIDENCE_ROOT="${HEADLESS_EVIDENCE_ROOT:-$PWD/build/qa-evidence}"
88
mkdir -p "$EVIDENCE_ROOT"
99
EVIDENCE_DIR="$(mktemp -d "$EVIDENCE_ROOT/linux.XXXXXX")"
1010
chmod 0777 "$EVIDENCE_DIR"
11+
# The container writes evidence as its own non-root user, which lands on the
12+
# host as an id this user cannot read. Which id to hand it back to depends on
13+
# how the daemon maps them: rootful Docker maps uid to uid, so the invoking
14+
# user's id is correct, while rootless maps container root to the invoking user
15+
# and every other container id to an unreadable subuid.
16+
if docker info --format '{{join .SecurityOptions ","}}' 2>/dev/null | grep -q rootless; then
17+
EVIDENCE_OWNER="0:0"
18+
else
19+
EVIDENCE_OWNER="$(id -u):$(id -g)"
20+
fi
1121
restore_evidence_owner() {
1222
docker run --rm --user root -v "$EVIDENCE_DIR:/evidence" \
13-
headless-p1-test chown -R "$(id -u):$(id -g)" /evidence >/dev/null 2>&1 || true
23+
headless-p1-test chown -R "$EVIDENCE_OWNER" /evidence >/dev/null 2>&1 || true
1424
chmod 0700 "$EVIDENCE_DIR" >/dev/null 2>&1 || true
1525
}
1626
file_mode() {

0 commit comments

Comments
 (0)