
























@@ -6,14 +6,55 @@ source "$ROOT_DIR/scripts/lib/docker-e2e-logs.sh"
6677IMAGE_NAME="${OPENCLAW_BUNDLED_CHANNEL_DEPS_E2E_IMAGE:-openclaw-bundled-channel-deps-e2e}"
88UPDATE_BASELINE_VERSION="${OPENCLAW_BUNDLED_CHANNEL_UPDATE_BASELINE_VERSION:-2026.4.20}"
9+DOCKER_TARGET="${OPENCLAW_BUNDLED_CHANNEL_DOCKER_TARGET:-e2e-runner}"
10+HOST_BUILD="${OPENCLAW_BUNDLED_CHANNEL_HOST_BUILD:-1}"
11+PACKAGE_TGZ="${OPENCLAW_BUNDLED_CHANNEL_PACKAGE_TGZ:-}"
912RUN_CHANNEL_SCENARIOS="${OPENCLAW_BUNDLED_CHANNEL_SCENARIOS:-1}"
1013RUN_UPDATE_SCENARIO="${OPENCLAW_BUNDLED_CHANNEL_UPDATE_SCENARIO:-1}"
1114RUN_ROOT_OWNED_SCENARIO="${OPENCLAW_BUNDLED_CHANNEL_ROOT_OWNED_SCENARIO:-1}"
1215RUN_SETUP_ENTRY_SCENARIO="${OPENCLAW_BUNDLED_CHANNEL_SETUP_ENTRY_SCENARIO:-1}"
1316RUN_LOAD_FAILURE_SCENARIO="${OPENCLAW_BUNDLED_CHANNEL_LOAD_FAILURE_SCENARIO:-1}"
141715-echo "Building Docker image..."
16-run_logged bundled-channel-deps-build docker build -t "$IMAGE_NAME" -f "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR"
18+if [ "${OPENCLAW_SKIP_DOCKER_BUILD:-0}" = "1" ]; then
19+echo "Reusing Docker image: $IMAGE_NAME (OPENCLAW_SKIP_DOCKER_BUILD=1)"
20+else
21+echo "Building Docker image target $DOCKER_TARGET..."
22+ run_logged bundled-channel-deps-build docker build --target "$DOCKER_TARGET" -t "$IMAGE_NAME" -f "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR"
23+fi
24+25+prepare_package_tgz() {
26+if [ -n "$PACKAGE_TGZ" ]; then
27+if [ ! -f "$PACKAGE_TGZ" ]; then
28+echo "OPENCLAW_BUNDLED_CHANNEL_PACKAGE_TGZ does not exist: $PACKAGE_TGZ" >&2
29+exit 1
30+fi
31+ PACKAGE_TGZ="$(cd "$(dirname "$PACKAGE_TGZ")" && pwd)/$(basename "$PACKAGE_TGZ")"
32+return 0
33+fi
34+35+if [ "$HOST_BUILD" != "0" ]; then
36+echo "Building host package artifacts..."
37+ run_logged bundled-channel-deps-host-build pnpm build
38+else
39+echo "Skipping host build (OPENCLAW_BUNDLED_CHANNEL_HOST_BUILD=0)"
40+fi
41+42+echo "Writing package inventory and packing once..."
43+ run_logged bundled-channel-deps-inventory node --import tsx --input-type=module -e 'const { writePackageDistInventory } = await import("./src/infra/package-dist-inventory.ts"); await writePackageDistInventory(process.cwd());'
44+local pack_dir
45+ pack_dir="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-bundled-channel-pack.XXXXXX")"
46+ run_logged bundled-channel-deps-pack npm pack --ignore-scripts --pack-destination "$pack_dir"
47+ PACKAGE_TGZ="$(find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
48+if [ -z "$PACKAGE_TGZ" ]; then
49+echo "missing packed OpenClaw tarball" >&2
50+exit 1
51+fi
52+ PACKAGE_TGZ="$(cd "$(dirname "$PACKAGE_TGZ")" && pwd)/$(basename "$PACKAGE_TGZ")"
53+}
54+55+prepare_package_tgz
56+DOCKER_PACKAGE_TGZ="/tmp/openclaw-current.tgz"
57+PACKAGE_DOCKER_ARGS=(-v "$PACKAGE_TGZ:$DOCKER_PACKAGE_TGZ:ro" -e "OPENCLAW_CURRENT_PACKAGE_TGZ=$DOCKER_PACKAGE_TGZ")
17581859run_channel_scenario() {
1960local channel="$1"
@@ -26,6 +67,7 @@ run_channel_scenario() {
2667 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
2768 -e OPENCLAW_CHANNEL_UNDER_TEST="$channel" \
2869 -e OPENCLAW_DEP_SENTINEL="$dep_sentinel" \
70+"${PACKAGE_DOCKER_ARGS[@]}" \
2971 -i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'
3072set -euo pipefail
3173@@ -49,15 +91,8 @@ cleanup() {
4991}
5092trap cleanup EXIT
519352-echo "Packing and installing current OpenClaw build..."
53-pack_dir="$(mktemp -d "/tmp/openclaw-pack.XXXXXX")"
54-npm pack --ignore-scripts --pack-destination "$pack_dir" >/tmp/openclaw-pack.log 2>&1
55-package_tgz="$(find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
56-if [ -z "$package_tgz" ]; then
57- cat /tmp/openclaw-pack.log
58- echo "missing packed OpenClaw tarball" >&2
59- exit 1
60-fi
94+echo "Installing mounted OpenClaw package..."
95+package_tgz="${OPENCLAW_CURRENT_PACKAGE_TGZ:?missing OPENCLAW_CURRENT_PACKAGE_TGZ}"
6196npm install -g "$package_tgz" --no-fund --no-audit >/tmp/openclaw-install.log 2>&1
62976398command -v openclaw >/dev/null
@@ -361,6 +396,7 @@ run_root_owned_global_scenario() {
361396echo "Running bundled channel root-owned global install Docker E2E..."
362397if ! docker run --rm --user root \
363398 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
399+"${PACKAGE_DOCKER_ARGS[@]}" \
364400 -i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'
365401set -euo pipefail
366402@@ -387,15 +423,8 @@ cleanup() {
387423}
388424trap cleanup EXIT
389425390-echo "Packing and installing current OpenClaw build into root-owned global npm..."
391-pack_dir="$(mktemp -d "/tmp/openclaw-root-owned-pack.XXXXXX")"
392-npm pack --ignore-scripts --pack-destination "$pack_dir" >/tmp/openclaw-root-owned-pack.log 2>&1
393-package_tgz="$(find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
394-if [ -z "$package_tgz" ]; then
395- cat /tmp/openclaw-root-owned-pack.log
396- echo "missing packed OpenClaw tarball" >&2
397- exit 1
398-fi
426+echo "Installing mounted OpenClaw package into root-owned global npm..."
427+package_tgz="${OPENCLAW_CURRENT_PACKAGE_TGZ:?missing OPENCLAW_CURRENT_PACKAGE_TGZ}"
399428npm install -g "$package_tgz" --no-fund --no-audit >/tmp/openclaw-root-owned-install.log 2>&1
400429401430root="$(package_root)"
@@ -550,6 +579,7 @@ run_setup_entry_scenario() {
550579echo "Running bundled channel setup-entry runtime deps Docker E2E..."
551580if ! docker run --rm \
552581 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
582+"${PACKAGE_DOCKER_ARGS[@]}" \
553583 -i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'
554584set -euo pipefail
555585@@ -566,15 +596,8 @@ package_root() {
566596 printf "%s/openclaw" "$(npm root -g)"
567597}
568598569-echo "Packing and installing current OpenClaw build..."
570-pack_dir="$(mktemp -d "/tmp/openclaw-setup-entry-pack.XXXXXX")"
571-npm pack --ignore-scripts --pack-destination "$pack_dir" >/tmp/openclaw-setup-entry-pack.log 2>&1
572-package_tgz="$(find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
573-if [ -z "$package_tgz" ]; then
574- cat /tmp/openclaw-setup-entry-pack.log
575- echo "missing packed OpenClaw tarball" >&2
576- exit 1
577-fi
599+echo "Installing mounted OpenClaw package..."
600+package_tgz="${OPENCLAW_CURRENT_PACKAGE_TGZ:?missing OPENCLAW_CURRENT_PACKAGE_TGZ}"
578601npm install -g "$package_tgz" --no-fund --no-audit >/tmp/openclaw-setup-entry-install.log 2>&1
579602580603root="$(package_root)"
@@ -660,6 +683,7 @@ run_update_scenario() {
660683if ! docker run --rm \
661684 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
662685 -e OPENCLAW_BUNDLED_CHANNEL_UPDATE_BASELINE_VERSION="$UPDATE_BASELINE_VERSION" \
686+"${PACKAGE_DOCKER_ARGS[@]}" \
663687 -i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'
664688set -euo pipefail
665689@@ -677,20 +701,7 @@ package_root() {
677701 printf "%s/openclaw" "$(npm root -g)"
678702}
679703680-pack_current_candidate() {
681- local pack_dir
682- pack_dir="$(mktemp -d "/tmp/openclaw-update-pack.XXXXXX")"
683- node --import tsx --input-type=module -e 'const { writePackageDistInventory } = await import("./src/infra/package-dist-inventory.ts"); await writePackageDistInventory(process.cwd());' >/tmp/openclaw-update-inventory.log 2>&1
684- npm pack --ignore-scripts --pack-destination "$pack_dir" >/tmp/openclaw-update-pack.log 2>&1
685- find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit
686-}
687-688-package_tgz="$(pack_current_candidate)"
689-if [ -z "$package_tgz" ]; then
690- cat /tmp/openclaw-update-pack.log
691- echo "missing packed OpenClaw candidate tarball" >&2
692- exit 1
693-fi
704+package_tgz="${OPENCLAW_CURRENT_PACKAGE_TGZ:?missing OPENCLAW_CURRENT_PACKAGE_TGZ}"
694705update_target="file:$package_tgz"
695706candidate_version="$(node - <<'NODE' "$package_tgz"
696707const { execFileSync } = require("node:child_process");
@@ -1009,6 +1020,7 @@ run_load_failure_scenario() {
10091020echo "Running bundled channel load-failure isolation Docker E2E..."
10101021if ! docker run --rm \
10111022 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
1023+"${PACKAGE_DOCKER_ARGS[@]}" \
10121024 -i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'
10131025set -euo pipefail
10141026@@ -1021,15 +1033,8 @@ package_root() {
10211033 printf "%s/openclaw" "$(npm root -g)"
10221034}
102310351024-echo "Packing and installing current OpenClaw build..."
1025-pack_dir="$(mktemp -d "/tmp/openclaw-load-failure-pack.XXXXXX")"
1026-npm pack --ignore-scripts --pack-destination "$pack_dir" >/tmp/openclaw-load-failure-pack.log 2>&1
1027-package_tgz="$(find "$pack_dir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
1028-if [ -z "$package_tgz" ]; then
1029- cat /tmp/openclaw-load-failure-pack.log
1030- echo "missing packed OpenClaw tarball" >&2
1031- exit 1
1032-fi
1036+echo "Installing mounted OpenClaw package..."
1037+package_tgz="${OPENCLAW_CURRENT_PACKAGE_TGZ:?missing OPENCLAW_CURRENT_PACKAGE_TGZ}"
10331038npm install -g "$package_tgz" --no-fund --no-audit >/tmp/openclaw-load-failure-install.log 2>&1
1034103910351040root="$(package_root)"
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。