fix: harden parallels upgrade flows

This commit is contained in:
Peter Steinberger
2026-04-08 03:43:54 +01:00
parent 81969c7a91
commit c4efdeddd5
4 changed files with 52 additions and 14 deletions

View File

@@ -1067,7 +1067,7 @@
"android:test:integration": "OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_ANDROID_NODE=1 node scripts/run-vitest.mjs run --config vitest.live.config.ts src/gateway/android-node.capabilities.live.test.ts",
"android:test:third-party": "cd apps/android && ./gradlew :app:testThirdPartyDebugUnitTest",
"audit:seams": "node scripts/audit-seams.mjs",
"build": "pnpm canvas:a2ui:bundle && node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node scripts/build-stamp.mjs && pnpm build:plugin-sdk:dts && node --import tsx scripts/write-plugin-sdk-entry-dts.ts && node scripts/check-plugin-sdk-exports.mjs && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/copy-export-html-templates.ts && node --import tsx scripts/write-build-info.ts && node --experimental-strip-types scripts/write-cli-startup-metadata.ts && node --import tsx scripts/write-cli-compat.ts",
"build": "node scripts/build-all.mjs",
"build:docker": "node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node scripts/build-stamp.mjs && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/copy-export-html-templates.ts && node --import tsx scripts/write-build-info.ts && node --experimental-strip-types scripts/write-cli-startup-metadata.ts && node --import tsx scripts/write-cli-compat.ts",
"build:plugin-sdk:dts": "tsc -p tsconfig.plugin-sdk.dts.json",
"build:strict-smoke": "pnpm canvas:a2ui:bundle && node scripts/tsdown-build.mjs && node scripts/runtime-postbuild.mjs && node scripts/build-stamp.mjs && pnpm build:plugin-sdk:dts && node --import tsx scripts/write-plugin-sdk-entry-dts.ts && node scripts/check-plugin-sdk-exports.mjs",

39
scripts/build-all.mjs Normal file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env node
import { spawnSync } from "node:child_process";
const nodeBin = process.execPath;
const pnpmBin = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
const steps = [
{ cmd: pnpmBin, args: ["canvas:a2ui:bundle"] },
{ cmd: nodeBin, args: ["scripts/tsdown-build.mjs"] },
{ cmd: nodeBin, args: ["scripts/runtime-postbuild.mjs"] },
{ cmd: nodeBin, args: ["scripts/build-stamp.mjs"] },
{ cmd: pnpmBin, args: ["build:plugin-sdk:dts"] },
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/write-plugin-sdk-entry-dts.ts"] },
{ cmd: nodeBin, args: ["scripts/check-plugin-sdk-exports.mjs"] },
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/canvas-a2ui-copy.ts"] },
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/copy-hook-metadata.ts"] },
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/copy-export-html-templates.ts"] },
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/write-build-info.ts"] },
{
cmd: nodeBin,
args: ["--experimental-strip-types", "scripts/write-cli-startup-metadata.ts"],
},
{ cmd: nodeBin, args: ["--import", "tsx", "scripts/write-cli-compat.ts"] },
];
for (const step of steps) {
const result = spawnSync(step.cmd, step.args, {
stdio: "inherit",
env: process.env,
});
if (typeof result.status === "number") {
if (result.status !== 0) {
process.exit(result.status);
}
continue;
}
process.exit(1);
}

View File

@@ -666,7 +666,7 @@ run_logged_guest_current_user_sh() {
local done_path="$3"
local timeout_s="$4"
local runner_path="$5"
local deadline rc runner_body write_runner_cmd line
local deadline rc runner_body write_runner_cmd
guest_current_user_exec /bin/rm -f "$log_path" "$done_path" "$runner_path"
runner_body="$(cat <<EOF
set -eu
@@ -680,9 +680,9 @@ $script
EOF
)"
write_runner_cmd="/bin/rm -f $(shell_quote "$runner_path")"$'\n'
while IFS= read -r line; do
write_runner_cmd+="/usr/bin/printf '%s\\n' $(shell_quote "$line") >> $(shell_quote "$runner_path")"$'\n'
done <<< "$runner_body"
write_runner_cmd+="cat > $(shell_quote "$runner_path") <<'__OPENCLAW_RUNNER__'"$'\n'
write_runner_cmd+="$runner_body"$'\n'
write_runner_cmd+="__OPENCLAW_RUNNER__"$'\n'
write_runner_cmd+="/bin/chmod +x $(shell_quote "$runner_path")"$'\n'
write_runner_cmd+="nohup /bin/bash $(shell_quote "$runner_path") > $(shell_quote "$log_path") 2>&1 < /dev/null &"
guest_current_user_sh "$write_runner_cmd"
@@ -785,7 +785,7 @@ repair_legacy_dev_source_checkout_if_needed() {
}
run_dev_channel_update() {
local bootstrap_bin update_entry update_root update_log update_done update_runner update_rc
local bootstrap_bin update_root update_log update_done update_runner update_rc
bootstrap_bin="/tmp/openclaw-smoke-pnpm-bootstrap/node_modules/.bin"
update_root="$(resolve_guest_current_user_home)/openclaw"
update_log="/tmp/openclaw-smoke-update-dev.log"
@@ -807,17 +807,15 @@ EOF
guest_current_user_tail_file "$update_log" 120 >&2 || true
fi
repair_legacy_dev_source_checkout_if_needed
update_entry="$update_root/openclaw.mjs"
printf 'update-dev: git-version\n'
guest_current_user_exec "$GUEST_NODE_BIN" "$update_entry" --version
guest_current_user_exec "$GUEST_NODE_BIN" "$GUEST_OPENCLAW_ENTRY" --version
printf 'update-dev: git-status\n'
guest_current_user_exec "$GUEST_NODE_BIN" "$update_entry" update status --json
guest_current_user_exec "$GUEST_NODE_BIN" "$GUEST_OPENCLAW_ENTRY" update status --json
}
verify_dev_channel_update() {
local status_json update_entry
update_entry="$(resolve_guest_current_user_home)/openclaw/openclaw.mjs"
status_json="$(guest_current_user_exec "$GUEST_NODE_BIN" "$update_entry" update status --json)"
local status_json
status_json="$(guest_current_user_exec "$GUEST_NODE_BIN" "$GUEST_OPENCLAW_ENTRY" update status --json)"
printf '%s\n' "$status_json"
printf '%s\n' "$status_json" | grep -F '"installKind": "git"'
printf '%s\n' "$status_json" | grep -F '"value": "dev"'

View File

@@ -1585,7 +1585,7 @@ try {
$bootstrapBin = Join-Path $bootstrapRoot 'node_modules\.bin'
$env:PATH = "$bootstrapBin;$portableGit\cmd;$portableGit\mingw64\bin;$env:PATH"
$env:ComSpec = Join-Path $env:SystemRoot 'System32\cmd.exe'
$env:npm_config_script_shell = $env:ComSpec
$env:npm_config_ignore_scripts = 'true'
$openclaw = Join-Path $env:APPDATA 'npm\openclaw.cmd'
$gitRoot = Join-Path $env:USERPROFILE 'openclaw'
$gitEntry = Join-Path $gitRoot 'openclaw.mjs'
@@ -1599,7 +1599,8 @@ try {
$env:TEMP = $shortTemp
$env:TMP = $shortTemp
Write-LoggedLine ("TEMP=" + $env:TEMP)
Write-LoggedLine ("npm_config_script_shell=" + $env:npm_config_script_shell)
Write-LoggedLine ("ComSpec=" + $env:ComSpec)
Write-LoggedLine ("npm_config_ignore_scripts=" + $env:npm_config_ignore_scripts)
Write-ProgressLog 'update.where-pnpm-pre'
$pnpmPre = Get-Command pnpm -ErrorAction SilentlyContinue