fix(docker): harden docker e2e scripts

This commit is contained in:
Peter Steinberger
2026-01-14 00:23:37 +00:00
parent b1102cedd7
commit b2179de839
3 changed files with 53 additions and 50 deletions

View File

@@ -67,7 +67,8 @@ LOGINCTL
chmod +x /tmp/clawdbot-bin/loginctl chmod +x /tmp/clawdbot-bin/loginctl
# Install the npm-global variant from the local /app source. # Install the npm-global variant from the local /app source.
npm install -g --prefix /tmp/npm-prefix /app pkg_tgz="$(npm pack --silent /app)"
npm install -g --prefix /tmp/npm-prefix "/app/$pkg_tgz"
npm_bin="/tmp/npm-prefix/bin/clawdbot" npm_bin="/tmp/npm-prefix/bin/clawdbot"
npm_entry="/tmp/npm-prefix/lib/node_modules/clawdbot/dist/entry.js" npm_entry="/tmp/npm-prefix/lib/node_modules/clawdbot/dist/entry.js"
@@ -84,6 +85,8 @@ LOGINCTL
fi fi
exec_line="${exec_line#ExecStart=}" exec_line="${exec_line#ExecStart=}"
entrypoint=$(echo "$exec_line" | awk "{print \$2}") entrypoint=$(echo "$exec_line" | awk "{print \$2}")
entrypoint="${entrypoint%\"}"
entrypoint="${entrypoint#\"}"
if [ "$entrypoint" != "$expected" ]; then if [ "$entrypoint" != "$expected" ]; then
echo "Expected entrypoint $expected, got $entrypoint" echo "Expected entrypoint $expected, got $entrypoint"
exit 1 exit 1
@@ -122,13 +125,13 @@ LOGINCTL
"npm-to-git" \ "npm-to-git" \
"$npm_bin daemon install --force" \ "$npm_bin daemon install --force" \
"$npm_entry" \ "$npm_entry" \
"node $git_entry doctor --repair" \ "node $git_entry doctor --repair --force" \
"$git_entry" "$git_entry"
run_flow \ run_flow \
"git-to-npm" \ "git-to-npm" \
"node $git_entry daemon install --force" \ "node $git_entry daemon install --force" \
"$git_entry" \ "$git_entry" \
"$npm_bin doctor --repair" \ "$npm_bin doctor --repair --force" \
"$npm_entry" "$npm_entry"
' '

View File

@@ -99,17 +99,17 @@ ws.send(
auth: { token }, auth: { token },
}, },
}), }),
); );
const connectRes = await onceFrame((o) => o?.type === \"res\" && o?.id === \"c1\"); const connectRes = await onceFrame((o) => o?.type === \"res\" && o?.id === \"c1\");
if (!connectRes.ok) throw new Error(`connect failed: ${connectRes.error?.message ?? \"unknown\"}`); if (!connectRes.ok) throw new Error(\"connect failed: \" + (connectRes.error?.message ?? \"unknown\"));
ws.send(JSON.stringify({ type: \"req\", id: \"h1\", method: \"health\" })); ws.send(JSON.stringify({ type: \"req\", id: \"h1\", method: \"health\" }));
const healthRes = await onceFrame((o) => o?.type === \"res\" && o?.id === \"h1\", 10000); const healthRes = await onceFrame((o) => o?.type === \"res\" && o?.id === \"h1\", 10000);
if (!healthRes.ok) throw new Error(`health failed: ${healthRes.error?.message ?? \"unknown\"}`); if (!healthRes.ok) throw new Error(\"health failed: \" + (healthRes.error?.message ?? \"unknown\"));
if (healthRes.payload?.ok !== true) throw new Error(\"unexpected health payload\"); if (healthRes.payload?.ok !== true) throw new Error(\"unexpected health payload\");
ws.close(); ws.close();
console.log(\"ok\"); console.log(\"ok\");
NODE" NODE"
echo "OK" echo "OK"

View File

@@ -12,7 +12,7 @@ docker run --rm -t "$IMAGE_NAME" bash -lc '
set -euo pipefail set -euo pipefail
trap "" PIPE trap "" PIPE
export TERM=xterm-256color export TERM=xterm-256color
ONBOARD_FLAGS="--flow quickstart --auth-choice skip --skip-providers --skip-skills --skip-daemon --skip-ui" ONBOARD_FLAGS="--flow quickstart --auth-choice skip --skip-channels --skip-skills --skip-daemon --skip-ui"
# Provide a minimal trash shim to avoid noisy "missing trash" logs in containers. # Provide a minimal trash shim to avoid noisy "missing trash" logs in containers.
export PATH="/tmp/clawdbot-bin:$PATH" export PATH="/tmp/clawdbot-bin:$PATH"
@@ -135,7 +135,7 @@ TRASH
} }
send_local_basic() { send_local_basic() {
# Choose local gateway, accept defaults, skip provider/skills/daemon, skip UI. # Choose local gateway, accept defaults, skip channels/skills/daemon, skip UI.
send $'"'"'\r'"'"' 0.5 send $'"'"'\r'"'"' 0.5
} }
@@ -149,14 +149,14 @@ TRASH
send_local_basic send_local_basic
} }
send_providers_flow() { send_channels_flow() {
# Configure providers via configure wizard. # Configure channels via configure wizard.
send $'"'"'\r'"'"' 1.0 send $'"'"'\r'"'"' 1.0
send "" 1.5 send "" 1.5
# Provider mode (default Configure providers) # Mode (default Configure channels)
send $'"'"'\r'"'"' 0.8 send $'"'"'\r'"'"' 0.8
send "" 1.0 send "" 1.0
# Configure chat providers now? -> No # Configure chat channels now? -> No
send $'"'"'n\r'"'"' 0.6 send $'"'"'n\r'"'"' 0.6
} }
@@ -339,11 +339,11 @@ if (errors.length > 0) {
NODE NODE
} }
run_case_providers() { run_case_channels() {
local home_dir local home_dir
home_dir="$(make_home providers)" home_dir="$(make_home channels)"
# Providers-only configure flow. # Channels-only configure flow.
run_wizard_cmd providers "$home_dir" "node dist/index.js configure --section providers" send_providers_flow run_wizard_cmd channels "$home_dir" "node dist/index.js configure --section channels" send_channels_flow
config_path="$HOME/.clawdbot/clawdbot.json" config_path="$HOME/.clawdbot/clawdbot.json"
assert_file "$config_path" assert_file "$config_path"
@@ -440,7 +440,7 @@ NODE
run_case_local_basic run_case_local_basic
run_case_remote_non_interactive run_case_remote_non_interactive
run_case_reset run_case_reset
run_case_providers run_case_channels
run_case_skills run_case_skills
' '