@@ -6,12 +6,13 @@ set -euo pipefail
66ROOT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /../.." && pwd) "
77source " $ROOT_DIR /scripts/lib/docker-e2e-image.sh"
88source " $ROOT_DIR /scripts/lib/docker-e2e-package.sh"
9+ source " $ROOT_DIR /scripts/e2e/lib/prepublish-plugin-registry.sh"
910
1011IMAGE_NAME=" $( docker_e2e_resolve_image " openclaw-codex-on-demand-e2e" OPENCLAW_CODEX_ON_DEMAND_E2E_IMAGE) "
1112DOCKER_TARGET=" ${OPENCLAW_CODEX_ON_DEMAND_DOCKER_TARGET:- bare} "
1213HOST_BUILD=" ${OPENCLAW_CODEX_ON_DEMAND_HOST_BUILD:- 1} "
1314PACKAGE_TGZ=" ${OPENCLAW_CURRENT_PACKAGE_TGZ:- } "
14- PREPUBLISH_PLUGIN_REGISTRY_ARGS =()
15+ OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DOCKER_ARGS =()
1516AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT=" "
1617run_log=" "
1718
@@ -20,33 +21,9 @@ run_log=""
2021# the Codex assertions instead of failing as a silent package-install timeout.
2122export OPENCLAW_E2E_NPM_INSTALL_TIMEOUT=" ${OPENCLAW_E2E_NPM_INSTALL_TIMEOUT:- 1200s} "
2223
23- configure_prepublish_plugin_registry () {
24- local registry_dir=" $1 "
25- local resolved_registry_dir
26- resolved_registry_dir=" $( cd " $registry_dir " && pwd) "
27- local manifest=" $resolved_registry_dir /prepublish-plugin-registry.json"
28- if [ ! -f " $manifest " ]; then
29- echo " Prepublish plugin registry manifest is missing." >&2
30- exit 1
31- fi
32- local source_sha=" ${OPENCLAW_DOCKER_E2E_SELECTED_SHA:- } "
33- local candidate_version=" ${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_CANDIDATE_VERSION:- } "
34- local manifest_sha256=" ${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_MANIFEST_SHA256:- } "
35- source_sha=" ${source_sha:- $(node -e ' process.stdout.write(require(process.argv[1]).sourceSha)' " $manifest " )} "
36- candidate_version=" ${candidate_version:- $(node -e ' process.stdout.write(require(process.argv[1]).candidateVersion)' " $manifest " )} "
37- if [ -z " $manifest_sha256 " ]; then
38- manifest_sha256=" $( node -e ' const fs=require("node:fs"),crypto=require("node:crypto");process.stdout.write(crypto.createHash("sha256").update(fs.readFileSync(process.argv[1])).digest("hex"))' " $manifest " ) "
39- fi
40- PREPUBLISH_PLUGIN_REGISTRY_ARGS=(
41- -e OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR=/tmp/openclaw-prepublish-plugin-registry
42- -e OPENCLAW_DOCKER_E2E_SELECTED_SHA=" $source_sha "
43- -e OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_CANDIDATE_VERSION=" $candidate_version "
44- -e OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_MANIFEST_SHA256=" $manifest_sha256 "
45- -v " $resolved_registry_dir :/tmp/openclaw-prepublish-plugin-registry:ro"
46- )
47- }
4824if [ -n " ${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:- } " ]; then
49- configure_prepublish_plugin_registry " $OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR "
25+ openclaw_prepublish_plugin_registry_configure_docker_args \
26+ " $OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR "
5027fi
5128
5229cleanup () {
@@ -88,7 +65,7 @@ if [ -z "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:-}" ] &&
8865 OPENCLAW_DOCKER_ALL_LOG_DIR=" $AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT " \
8966 OPENCLAW_DOCKER_ALL_TIMINGS=0 \
9067 node " $ROOT_DIR /scripts/test-docker-all.mjs" --prepare-plugin-registry > /dev/null
91- configure_prepublish_plugin_registry \
68+ openclaw_prepublish_plugin_registry_configure_docker_args \
9269 " $AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT /prepublish-plugin-registry"
9370fi
9471
@@ -100,7 +77,7 @@ echo "Running Codex on-demand Docker E2E..."
10077if ! docker_e2e_run_with_harness \
10178 -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
10279 -e " OPENCLAW_TEST_STATE_SCRIPT_B64=$OPENCLAW_TEST_STATE_SCRIPT_B64 " \
103- ${PREPUBLISH_PLUGIN_REGISTRY_ARGS[@]+ " ${PREPUBLISH_PLUGIN_REGISTRY_ARGS [@]} " } \
80+ " ${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DOCKER_ARGS [@]} " \
10481 " ${DOCKER_E2E_PACKAGE_ARGS[@]} " \
10582 -i " $IMAGE_NAME " bash -s > " $run_log " 2>&1 << 'EOF '; then
10683set -euo pipefail
@@ -135,16 +112,8 @@ cleanup_inner() {
135112trap cleanup_inner EXIT
136113
137114configure_plugin_registry() {
138- [ -n "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:-}" ] || return 0
139- local registry_root="/tmp/openclaw-codex-registry"
140- OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_REQUIRED_PACKAGES_JSON='["@openclaw/codex"]' \
141- openclaw_prepublish_plugin_registry_start \
142- "$OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR" \
143- "${OPENCLAW_DOCKER_E2E_SELECTED_SHA:?missing selected SHA}" \
144- "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_CANDIDATE_VERSION:?missing candidate version}" \
145- "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_MANIFEST_SHA256:?missing manifest SHA-256}" \
146- "$registry_root" \
147- plugin_registry_pid
115+ openclaw_prepublish_plugin_registry_start_mounted \
116+ /tmp/openclaw-codex-registry plugin_registry_pid '["@openclaw/codex"]'
148117}
149118
150119mkdir -p "$NPM_CONFIG_PREFIX" "$XDG_CACHE_HOME" "$NPM_CONFIG_CACHE"
0 commit comments