Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Gate VMs run CI's pinned Node instead of apt's Node 18

garrytan9478a5d4e9ad
diff --git a/scripts/ubicloud/setup-ci-vm.sh b/scripts/ubicloud/setup-ci-vm.sh
index 65d941f6ae..85aebfdda8 100755
--- a/scripts/ubicloud/setup-ci-vm.sh
+++ b/scripts/ubicloud/setup-ci-vm.sh
@@ -5,7 +5,10 @@
#
# Provides what the ci:local runner container provides, per VM:
# - bun (pinned; BUN_VERSION, matching docker-compose.ci.yml's runner tag)
-# - git, python3, procps, psql, jq, node, cc, timeout (test prerequisites)
+# - node (pinned; NODE_VERSION, matching native-locks.yml's setup-node, from
+# nodejs.org and checksum-verified: apt's Node 18 cannot import a .ts file,
+# which test/skill-resolver-packaging.test.ts does)
+# - git, python3, procps, psql, jq, cc, timeout (test prerequisites)
# - SLOTS isolated pgvector/pgvector:pg16 servers, each fronted by a
# transaction-mode PgBouncer, so every E2E slot owns its whole server just
# as each ci:local shard owns postgres-N (slot i: postgres on
@@ -24,7 +27,8 @@
# the packages are already installed, so apt is skipped and the image pulls
# only confirm the baked images are current.
#
-# Knobs: SLOTS (default nproc), BUN_VERSION (default 1.4.4), GITLEAKS=0|1,
+# Knobs: SLOTS (default nproc), BUN_VERSION (default 1.4.4), NODE_VERSION
+# (default 24.18.0), GITLEAKS=0|1,
# CHECKOUT (default .), CHECKOUT_MARKER (default: none, checkout present),
# PG_IMAGE (default pgvector/pgvector:pg16; ci-ubicloud.ts --pg-image, e.g.
# pgvector/pgvector:pg15 for the #7112 compatibility audit),
@@ -34,11 +38,12 @@ set -euo pipefail
SLOTS="${SLOTS:-$(nproc)}"
BUN_VERSION="${BUN_VERSION:-1.4.4}"
+NODE_VERSION="${NODE_VERSION:-24.18.0}"
GITLEAKS="${GITLEAKS:-0}"
CHECKOUT="${CHECKOUT:-.}"
CHECKOUT_MARKER="${CHECKOUT_MARKER:-}"
GITLEAKS_VERSION=8.30.1
-APT_PACKAGES=(git ca-certificates python3 procps postgresql-client jq nodejs gcc libc6-dev)
+APT_PACKAGES=(git ca-certificates python3 procps postgresql-client jq gcc libc6-dev)
PG_IMAGE="${PG_IMAGE:-pgvector/pgvector:pg16}"
PGBOUNCER_IMAGE=edoburu/pgbouncer:latest
# Throwaway password of the loopback-only test servers (docker-compose.ci.yml uses the same).
@@ -72,7 +77,7 @@ apt_get() {
# disconnected from message bus").
install_system() {
local pg_pull pgb_pull bin baked=1
- for bin in docker psql node cc jq git; do command -v "$bin" >/dev/null || baked=0; done
+ for bin in docker psql cc jq git; do command -v "$bin" >/dev/null || baked=0; done
if [ "$baked" = 1 ]; then
sudo docker pull -q "$PG_IMAGE" >/dev/null
sudo docker pull -q "$PGBOUNCER_IMAGE" >/dev/null
@@ -132,6 +137,22 @@ system_pid=$!
) &
bun_pid=$!
+# Node from nodejs.org into /usr/local (ahead of any apt or baked /usr/bin/node on PATH).
+(
+ arch=x64
+ [ "$(uname -m)" = aarch64 ] && arch=arm64
+ base="node-v${NODE_VERSION}-linux-${arch}.tar.gz"
+ url="https://nodejs.org/dist/v${NODE_VERSION}"
+ tmp=$(mktemp -d)
+ curl -fsSL --retry 5 --retry-all-errors --retry-delay 1 -o "$tmp/$base" "$url/$base"
+ curl -fsSL --retry 5 --retry-all-errors --retry-delay 1 -o "$tmp/SHASUMS256.txt" "$url/SHASUMS256.txt"
+ ( cd "$tmp" && grep " ${base}\$" SHASUMS256.txt | sha256sum -c - >/dev/null )
+ sudo tar -xzf "$tmp/$base" -C /usr/local --strip-components=1 --no-same-owner "node-v${NODE_VERSION}-linux-${arch}/bin" "node-v${NODE_VERSION}-linux-${arch}/lib" "node-v${NODE_VERSION}-linux-${arch}/include"
+ rm -rf "$tmp"
+ [ "$(/usr/local/bin/node --version)" = "v${NODE_VERSION}" ] || exit 1
+) >/tmp/gbrain-node.log 2>&1 &
+node_pid=$!
+
if [ "$GITLEAKS" = "1" ]; then
(
base="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
@@ -150,6 +171,8 @@ fi
wait "$bun_pid"
export PATH="$HOME/.bun/bin:$PATH"
step "bun $(bun --version)"
+wait "$node_pid" || { tail -20 /tmp/gbrain-node.log >&2; fail "node ${NODE_VERSION} did not install"; }
+step "node $(node --version)"
if [ -n "$CHECKOUT_MARKER" ]; then
for _ in $(seq 1 1200); do [ -e "$CHECKOUT_MARKER" ] && break; sleep 0.25; done
diff --git a/test/scripts/ci-pr-scope.test.ts b/test/scripts/ci-pr-scope.test.ts
index 71870fa31d..88c6ef6e93 100644
--- a/test/scripts/ci-pr-scope.test.ts
+++ b/test/scripts/ci-pr-scope.test.ts
@@ -306,6 +306,8 @@ esac
expect([...new Set(pinned)]).toEqual([primary]);
expect(/oven\/bun:\$\{GBRAIN_CI_BUN_TAG:-([^}]+)\}/.exec(read('docker-compose.ci.yml'))?.[1]).toBe(primary);
expect(/BUN_VERSION="\$\{BUN_VERSION:-([^}]+)\}"/.exec(read('scripts/ubicloud/setup-ci-vm.sh'))?.[1]).toBe(primary);
+ // A gate VM's Node is CI's pinned Node: apt's Node 18 cannot import the .ts file the packaging test imports.
+ expect(/NODE_VERSION="\$\{NODE_VERSION:-([^}]+)\}"/.exec(read('scripts/ubicloud/setup-ci-vm.sh'))?.[1]).toBe(/node-version:\s*(\S+)/.exec(read('.github/workflows/native-locks.yml'))?.[1]);
expect(/\?\? "([\d.]+)";/.exec(read('scripts/ci-ubicloud.ts'))?.[1]).toBe(primary);
expect(/^gbrain_bun_version=(\S+)$/m.exec(read('scripts/setup-in-agent.sh'))?.[1]).toBe(primary);
expect(/ARG BUN_IMAGE=oven\/bun:(\S+)/.exec(read('tests/docker/Dockerfile'))?.[1]).toBe(primary);