test: harden QA cleanup and update preflight

This commit is contained in:
Peter Steinberger
2026-04-25 23:16:19 +01:00
parent 81a41fe5be
commit 8f78932059
8 changed files with 132 additions and 10 deletions

View File

@@ -443,7 +443,7 @@ resolve_registry_target_version() {
if [[ "$spec" != openclaw@* ]]; then
spec="openclaw@$spec"
fi
npm view "$spec" version 2>/dev/null || true
npm view "$spec" version 2>/dev/null | tail -n 1 | tr -d '\r' || true
}
is_explicit_package_target() {
@@ -451,6 +451,19 @@ is_explicit_package_target() {
[[ "$target" == *"://"* || "$target" == *"#"* || "$target" =~ ^(file|github|git\+ssh|git\+https|git\+http|git\+file|npm): ]]
}
preflight_registry_update_target() {
local baseline_version target_version
[[ -n "$UPDATE_TARGET" && "$UPDATE_TARGET" != "local-main" ]] || return 0
is_explicit_package_target "$UPDATE_TARGET" && return 0
baseline_version="$(resolve_registry_target_version "$PACKAGE_SPEC")"
target_version="$(resolve_registry_target_version "$UPDATE_TARGET")"
[[ -n "$baseline_version" && -n "$target_version" ]] || return 0
if [[ "$baseline_version" == "$target_version" ]]; then
die "--update-target $UPDATE_TARGET resolves to openclaw@$target_version, same as baseline $PACKAGE_SPEC; publish or choose a newer --update-target before running VM update coverage"
fi
}
write_windows_update_script() {
WINDOWS_UPDATE_SCRIPT_PATH="$MAIN_TGZ_DIR/openclaw-main-update.ps1"
cat >"$WINDOWS_UPDATE_SCRIPT_PATH" <<'EOF'
@@ -1879,6 +1892,7 @@ LATEST_VERSION="$(resolve_latest_version)"
if [[ -z "$PACKAGE_SPEC" ]]; then
PACKAGE_SPEC="openclaw@$LATEST_VERSION"
fi
preflight_registry_update_target
resolve_current_head
if platform_enabled linux; then