mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:50:43 +00:00
test(docker): align package harness image
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
|
||||
FROM node:24-bookworm-slim@sha256:e8e2e91b1378f83c5b2dd15f0247f34110e2fe895f6ca7719dbb780f929368eb AS e2e-runner
|
||||
|
||||
# python3 covers package/plugin install paths that execute helper scripts while
|
||||
# staying below a full build-essential toolchain.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates git \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates git python3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN corepack enable
|
||||
@@ -40,10 +42,14 @@ FROM bare AS functional
|
||||
# The app under test enters through the named BuildKit context, not by copying
|
||||
# checkout sources into the image.
|
||||
COPY --from=openclaw_package --chown=appuser:appuser openclaw-current.tgz /tmp/openclaw-current.tgz
|
||||
# Preserve package self-reference imports such as openclaw/plugin-sdk/* after
|
||||
# copying the installed package out of npm's global node_modules tree.
|
||||
RUN npm install -g --prefix /tmp/openclaw-prefix /tmp/openclaw-current.tgz --no-fund --no-audit \
|
||||
&& cp -a /tmp/openclaw-prefix/lib/node_modules/openclaw/. /app/ \
|
||||
&& mkdir -p "$HOME/.local/bin" \
|
||||
&& ln -sf /app/openclaw.mjs "$HOME/.local/bin/openclaw" \
|
||||
&& mkdir -p /app/node_modules \
|
||||
&& ln -sf /app /app/node_modules/openclaw \
|
||||
&& rm -rf /tmp/openclaw-prefix /tmp/openclaw-current.tgz
|
||||
|
||||
CMD ["bash"]
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs QA diagnostics smoke checks inside the shared package-installed Docker
|
||||
# E2E image. The OpenClaw app under test comes from the prepared npm tarball;
|
||||
# only QA harness files are mounted read-only.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
|
||||
|
||||
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-docker-observability-e2e:local" OPENCLAW_DOCKER_OBSERVABILITY_E2E_IMAGE OPENCLAW_DOCKER_E2E_FUNCTIONAL_IMAGE)"
|
||||
SKIP_BUILD="${OPENCLAW_DOCKER_OBSERVABILITY_E2E_SKIP_BUILD:-0}"
|
||||
LOOPS="${OPENCLAW_DOCKER_OBSERVABILITY_LOOPS:-1}"
|
||||
OUTPUT_DIR="${OPENCLAW_DOCKER_OBSERVABILITY_OUTPUT_DIR:-$ROOT_DIR/.artifacts/docker-observability/$(date +%Y%m%d-%H%M%S)}"
|
||||
|
||||
if ! [[ "$LOOPS" =~ ^[1-9][0-9]*$ ]]; then
|
||||
echo "OPENCLAW_DOCKER_OBSERVABILITY_LOOPS must be a positive integer, got: $LOOPS" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
docker_e2e_build_or_reuse "$IMAGE_NAME" docker-observability "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR" "" "$SKIP_BUILD"
|
||||
docker_e2e_harness_mount_args
|
||||
|
||||
echo "Running Docker observability smoke with $LOOPS loop(s)..."
|
||||
run_logged docker-observability docker run --rm \
|
||||
-e "OPENCLAW_DOCKER_OBSERVABILITY_LOOPS=$LOOPS" \
|
||||
"${DOCKER_E2E_HARNESS_ARGS[@]}" \
|
||||
-v "$ROOT_DIR/scripts/qa-otel-smoke.ts:/app/scripts/qa-otel-smoke.ts:ro" \
|
||||
-v "$ROOT_DIR/qa:/app/qa:ro" \
|
||||
-v "$OUTPUT_DIR:/app/.artifacts/docker-observability-current" \
|
||||
"$IMAGE_NAME" \
|
||||
bash -lc '
|
||||
set -euo pipefail
|
||||
|
||||
loops="${OPENCLAW_DOCKER_OBSERVABILITY_LOOPS:-1}"
|
||||
artifact_root=".artifacts/docker-observability-current"
|
||||
mkdir -p "$artifact_root"
|
||||
|
||||
for i in $(seq 1 "$loops"); do
|
||||
iteration_dir="$artifact_root/loop-$i"
|
||||
mkdir -p "$iteration_dir"
|
||||
|
||||
echo "== docker observability loop $i/$loops: otel =="
|
||||
# The functional image has a global tsx runner for mounted harness files; the
|
||||
# published package intentionally does not ship tsx as an app dependency.
|
||||
tsx scripts/qa-otel-smoke.ts \
|
||||
--provider-mode mock-openai \
|
||||
--output-dir "$iteration_dir/otel"
|
||||
|
||||
echo "== docker observability loop $i/$loops: prometheus =="
|
||||
node openclaw.mjs qa suite \
|
||||
--provider-mode mock-openai \
|
||||
--scenario docker-prometheus-smoke \
|
||||
--concurrency 1 \
|
||||
--fast \
|
||||
--output-dir "$iteration_dir/prometheus"
|
||||
done
|
||||
'
|
||||
|
||||
echo "Docker observability smoke passed. Artifacts: $OUTPUT_DIR"
|
||||
@@ -184,13 +184,6 @@ export const mainLanes = [
|
||||
{ resources: ["service"], weight: 3 },
|
||||
),
|
||||
serviceLane("gateway-network", "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:gateway-network"),
|
||||
serviceLane(
|
||||
"observability",
|
||||
"OPENCLAW_SKIP_DOCKER_BUILD=1 bash scripts/e2e/docker-observability-smoke.sh",
|
||||
{
|
||||
weight: 3,
|
||||
},
|
||||
),
|
||||
serviceLane(
|
||||
"agents-delete-shared-workspace",
|
||||
"OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:agents-delete-shared-workspace",
|
||||
@@ -345,13 +338,6 @@ const releasePathChunks = {
|
||||
"pi-bundle-mcp-tools",
|
||||
"OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:pi-bundle-mcp-tools",
|
||||
),
|
||||
serviceLane(
|
||||
"observability",
|
||||
"OPENCLAW_SKIP_DOCKER_BUILD=1 bash scripts/e2e/docker-observability-smoke.sh",
|
||||
{
|
||||
weight: 3,
|
||||
},
|
||||
),
|
||||
serviceLane("mcp-channels", "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:mcp-channels", {
|
||||
resources: ["npm"],
|
||||
weight: 3,
|
||||
|
||||
@@ -287,14 +287,10 @@ function startLocalOtlpTraceReceiver() {
|
||||
}
|
||||
|
||||
function openClawEntryArgs(): string[] {
|
||||
if (
|
||||
existsSync(path.join(process.cwd(), "openclaw.mjs")) &&
|
||||
(existsSync(path.join(process.cwd(), "dist", "entry.js")) ||
|
||||
existsSync(path.join(process.cwd(), "dist", "entry.mjs")))
|
||||
) {
|
||||
return ["openclaw.mjs"];
|
||||
if (existsSync(path.join(process.cwd(), "scripts", "run-node.mjs"))) {
|
||||
return ["scripts/run-node.mjs"];
|
||||
}
|
||||
return ["scripts/run-node.mjs"];
|
||||
return ["openclaw.mjs"];
|
||||
}
|
||||
|
||||
function spawnOpenClaw(args: string[], env: NodeJS.ProcessEnv): ChildProcess {
|
||||
|
||||
Reference in New Issue
Block a user