diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca2ac54e8..4fe229d0cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ Docs: https://docs.openclaw.ai - Build: move TypeScript builds to `tsdown` + `tsgo` (faster builds, CI typechecks), update tsconfig target, and clean up lint rules. - Build: align npm tar override and bin metadata so the `openclaw` CLI entrypoint is preserved in npm publishes. - Docs: add pi/pi-dev docs and update OpenClaw branding + install links. +- Docker E2E: stabilize gateway readiness, plugin installs/manifests, and cleanup/doctor switch entrypoint checks. ### Fixes diff --git a/scripts/docker/cleanup-smoke/Dockerfile b/scripts/docker/cleanup-smoke/Dockerfile index f02ce5f6be..9aacf20ff0 100644 --- a/scripts/docker/cleanup-smoke/Dockerfile +++ b/scripts/docker/cleanup-smoke/Dockerfile @@ -10,6 +10,7 @@ RUN apt-get update \ WORKDIR /repo COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY scripts/postinstall.js ./scripts/postinstall.js +COPY scripts/setup-git-hooks.js ./scripts/setup-git-hooks.js RUN corepack enable \ && pnpm install --frozen-lockfile diff --git a/scripts/docker/cleanup-smoke/run.sh b/scripts/docker/cleanup-smoke/run.sh index d466dcc7f4..fb82676c30 100755 --- a/scripts/docker/cleanup-smoke/run.sh +++ b/scripts/docker/cleanup-smoke/run.sh @@ -6,6 +6,9 @@ cd /repo export OPENCLAW_STATE_DIR="/tmp/openclaw-test" export OPENCLAW_CONFIG_PATH="${OPENCLAW_STATE_DIR}/openclaw.json" +echo "==> Build" +pnpm build + echo "==> Seed state" mkdir -p "${OPENCLAW_STATE_DIR}/credentials" mkdir -p "${OPENCLAW_STATE_DIR}/agents/main/sessions" diff --git a/scripts/e2e/Dockerfile b/scripts/e2e/Dockerfile index 0ae4a50638..225cb8e2af 100644 --- a/scripts/e2e/Dockerfile +++ b/scripts/e2e/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /app ENV NODE_OPTIONS="--disable-warning=ExperimentalWarning" -COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json vitest.config.ts vitest.e2e.config.ts ./ +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json vitest.config.ts vitest.e2e.config.ts openclaw.mjs ./ COPY src ./src COPY test ./test COPY scripts ./scripts diff --git a/scripts/e2e/doctor-install-switch-docker.sh b/scripts/e2e/doctor-install-switch-docker.sh index 2a0b0c4f4a..a918cb0d92 100755 --- a/scripts/e2e/doctor-install-switch-docker.sh +++ b/scripts/e2e/doctor-install-switch-docker.sh @@ -81,8 +81,9 @@ LOGINCTL npm install -g --prefix /tmp/npm-prefix "/app/$pkg_tgz" npm_bin="/tmp/npm-prefix/bin/openclaw" - npm_entry="/tmp/npm-prefix/lib/node_modules/openclaw/openclaw.mjs" - git_entry="/app/openclaw.mjs" + npm_entry="/tmp/npm-prefix/lib/node_modules/openclaw/dist/index.js" + git_entry="/app/dist/index.js" + git_cli="/app/openclaw.mjs" assert_entrypoint() { local unit_path="$1" @@ -135,12 +136,12 @@ LOGINCTL "npm-to-git" \ "$npm_bin daemon install --force" \ "$npm_entry" \ - "node $git_entry doctor --repair --force" \ + "node $git_cli doctor --repair --force" \ "$git_entry" run_flow \ "git-to-npm" \ - "node $git_entry daemon install --force" \ + "node $git_cli daemon install --force" \ "$git_entry" \ "$npm_bin doctor --repair --force" \ "$npm_entry" diff --git a/scripts/e2e/gateway-network-docker.sh b/scripts/e2e/gateway-network-docker.sh index e0faf0115e..a3990e77c5 100644 --- a/scripts/e2e/gateway-network-docker.sh +++ b/scripts/e2e/gateway-network-docker.sh @@ -34,13 +34,41 @@ echo "Starting gateway container..." bash -lc "node dist/index.js gateway --port $PORT --bind lan --allow-unconfigured > /tmp/gateway-net-e2e.log 2>&1" echo "Waiting for gateway to come up..." -for _ in $(seq 1 20); do +ready=0 +for _ in $(seq 1 40); do + if docker exec "$GW_NAME" bash -lc "node --input-type=module -e ' + import net from \"node:net\"; + const socket = net.createConnection({ host: \"127.0.0.1\", port: $PORT }); + const timeout = setTimeout(() => { + socket.destroy(); + process.exit(1); + }, 400); + socket.on(\"connect\", () => { + clearTimeout(timeout); + socket.end(); + process.exit(0); + }); + socket.on(\"error\", () => { + clearTimeout(timeout); + process.exit(1); + }); + ' >/dev/null 2>&1"; then + ready=1 + break + fi if docker exec "$GW_NAME" bash -lc "grep -q \"listening on ws://\" /tmp/gateway-net-e2e.log"; then + ready=1 break fi sleep 0.5 done +if [ "$ready" -ne 1 ]; then + echo "Gateway failed to start" + docker exec "$GW_NAME" bash -lc "tail -n 80 /tmp/gateway-net-e2e.log" || true + exit 1 +fi + docker exec "$GW_NAME" bash -lc "tail -n 50 /tmp/gateway-net-e2e.log" echo "Running client container (connect + health)..." diff --git a/scripts/e2e/onboard-docker.sh b/scripts/e2e/onboard-docker.sh index 6e9a74ced6..f0f49b736f 100755 --- a/scripts/e2e/onboard-docker.sh +++ b/scripts/e2e/onboard-docker.sh @@ -280,7 +280,7 @@ TRASH --skip-health # Assert config + workspace scaffolding. - workspace_dir="$HOME/openclaw" + workspace_dir="$HOME/.openclaw/workspace" config_path="$HOME/.openclaw/openclaw.json" sessions_dir="$HOME/.openclaw/agents/main/sessions" diff --git a/scripts/e2e/plugins-docker.sh b/scripts/e2e/plugins-docker.sh index 5b0a9c5ae4..0cea4c5f9a 100755 --- a/scripts/e2e/plugins-docker.sh +++ b/scripts/e2e/plugins-docker.sh @@ -13,9 +13,9 @@ docker run --rm -t "$IMAGE_NAME" bash -lc ' home_dir=$(mktemp -d "/tmp/openclaw-plugins-e2e.XXXXXX") export HOME="$home_dir" - mkdir -p "$HOME/.openclaw/extensions" + mkdir -p "$HOME/.openclaw/extensions/demo-plugin" - cat > "$HOME/.openclaw/extensions/demo-plugin.js" <<'"'"'JS'"'"' + cat > "$HOME/.openclaw/extensions/demo-plugin/index.js" <<'"'"'JS'"'"' module.exports = { id: "demo-plugin", name: "Demo Plugin", @@ -28,6 +28,15 @@ module.exports = { }, }; JS + cat > "$HOME/.openclaw/extensions/demo-plugin/openclaw.plugin.json" <<'"'"'JSON'"'"' +{ + "id": "demo-plugin", + "configSchema": { + "type": "object", + "properties": {} + } +} +JSON node dist/index.js plugins list --json > /tmp/plugins.json @@ -79,6 +88,15 @@ module.exports = { }, }; JS + cat > "$pack_dir/package/openclaw.plugin.json" <<'"'"'JSON'"'"' +{ + "id": "demo-plugin-tgz", + "configSchema": { + "type": "object", + "properties": {} + } +} +JSON tar -czf /tmp/demo-plugin-tgz.tgz -C "$pack_dir" package node dist/index.js plugins install /tmp/demo-plugin-tgz.tgz @@ -117,6 +135,15 @@ module.exports = { }, }; JS + cat > "$dir_plugin/openclaw.plugin.json" <<'"'"'JSON'"'"' +{ + "id": "demo-plugin-dir", + "configSchema": { + "type": "object", + "properties": {} + } +} +JSON node dist/index.js plugins install "$dir_plugin" node dist/index.js plugins list --json > /tmp/plugins3.json @@ -155,6 +182,15 @@ module.exports = { }, }; JS + cat > "$file_pack_dir/package/openclaw.plugin.json" <<'"'"'JSON'"'"' +{ + "id": "demo-plugin-file", + "configSchema": { + "type": "object", + "properties": {} + } +} +JSON node dist/index.js plugins install "file:$file_pack_dir/package" node dist/index.js plugins list --json > /tmp/plugins4.json