Skip to content

Commit 0ed64f1

Browse files
committed
fix: mount CLI auth dirs in docker live tests
1 parent 78f24dc commit 0ed64f1

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

docs/help/testing.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ If you want to rely on env keys (e.g. exported in your `~/.profile`), run local
362362

363363
## Docker runners (optional “works in Linux” checks)
364364

365-
These run `pnpm test:live` inside the repo Docker image, mounting your local config dir and workspace (and sourcing `~/.profile` if mounted):
365+
These run `pnpm test:live` inside the repo Docker image, mounting your local config dir and workspace (and sourcing `~/.profile` if mounted). They also bind-mount CLI auth homes like `~/.codex`, `~/.claude`, `~/.qwen`, and `~/.minimax` when present so external-CLI OAuth stays available in-container:
366366

367367
- Direct models: `pnpm test:docker:live-models` (script: `scripts/test-live-models-docker.sh`)
368368
- Gateway + dev agent: `pnpm test:docker:live-gateway` (script: `scripts/test-live-gateway-models-docker.sh`)
@@ -384,6 +384,7 @@ Useful env vars:
384384
- `OPENCLAW_CONFIG_DIR=...` (default: `~/.openclaw`) mounted to `/home/node/.openclaw`
385385
- `OPENCLAW_WORKSPACE_DIR=...` (default: `~/.openclaw/workspace`) mounted to `/home/node/.openclaw/workspace`
386386
- `OPENCLAW_PROFILE_FILE=...` (default: `~/.profile`) mounted to `/home/node/.profile` and sourced before running tests
387+
- External CLI auth dirs under `$HOME` (`.codex`, `.claude`, `.qwen`, `.minimax`) are mounted read-only to the matching `/home/node/...` paths when present
387388
- `OPENCLAW_LIVE_GATEWAY_MODELS=...` / `OPENCLAW_LIVE_MODELS=...` to narrow the run
388389
- `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to ensure creds come from the profile store (not env)
389390

scripts/test-live-gateway-models-docker.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ if [[ -f "$PROFILE_FILE" ]]; then
1313
PROFILE_MOUNT=(-v "$PROFILE_FILE":/home/node/.profile:ro)
1414
fi
1515

16+
EXTERNAL_AUTH_MOUNTS=()
17+
for auth_dir in .claude .codex .minimax .qwen; do
18+
host_path="$HOME/$auth_dir"
19+
if [[ -d "$host_path" ]]; then
20+
EXTERNAL_AUTH_MOUNTS+=(-v "$host_path":/home/node/"$auth_dir":ro)
21+
fi
22+
done
23+
1624
read -r -d '' LIVE_TEST_CMD <<'EOF' || true
1725
set -euo pipefail
1826
[ -f "$HOME/.profile" ] && source "$HOME/.profile" || true
@@ -51,6 +59,7 @@ docker run --rm -t \
5159
-v "$ROOT_DIR":/src:ro \
5260
-v "$CONFIG_DIR":/home/node/.openclaw \
5361
-v "$WORKSPACE_DIR":/home/node/.openclaw/workspace \
62+
"${EXTERNAL_AUTH_MOUNTS[@]}" \
5463
"${PROFILE_MOUNT[@]}" \
5564
"$LIVE_IMAGE_NAME" \
5665
-lc "$LIVE_TEST_CMD"

scripts/test-live-models-docker.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ if [[ -f "$PROFILE_FILE" ]]; then
1313
PROFILE_MOUNT=(-v "$PROFILE_FILE":/home/node/.profile:ro)
1414
fi
1515

16+
EXTERNAL_AUTH_MOUNTS=()
17+
for auth_dir in .claude .codex .minimax .qwen; do
18+
host_path="$HOME/$auth_dir"
19+
if [[ -d "$host_path" ]]; then
20+
EXTERNAL_AUTH_MOUNTS+=(-v "$host_path":/home/node/"$auth_dir":ro)
21+
fi
22+
done
23+
1624
read -r -d '' LIVE_TEST_CMD <<'EOF' || true
1725
set -euo pipefail
1826
[ -f "$HOME/.profile" ] && source "$HOME/.profile" || true
@@ -52,6 +60,7 @@ docker run --rm -t \
5260
-v "$ROOT_DIR":/src:ro \
5361
-v "$CONFIG_DIR":/home/node/.openclaw \
5462
-v "$WORKSPACE_DIR":/home/node/.openclaw/workspace \
63+
"${EXTERNAL_AUTH_MOUNTS[@]}" \
5564
"${PROFILE_MOUNT[@]}" \
5665
"$LIVE_IMAGE_NAME" \
5766
-lc "$LIVE_TEST_CMD"

0 commit comments

Comments
 (0)