fix(fnos): reuse content-addressed core runtime

This commit is contained in:
2026-08-12 17:33:05 +08:00
parent eec1227179
commit 1babec1b85
5 changed files with 63 additions and 12 deletions
+2 -1
View File
@@ -50,6 +50,7 @@ PYTHON_BIN=$(command -v "$PYTHON_BIN") || {
printf 'Python with hatchling is required to assemble the release.\n' >&2
exit 1
}
APP_VERSION=$("$PYTHON_BIN" -c 'import pathlib,sys,tomllib; print(tomllib.loads(pathlib.Path(sys.argv[1]).read_text())["project"]["version"])' "$PROJECT_ROOT/pyproject.toml")
command -v npm >/dev/null 2>&1 || { printf 'npm is required.\n' >&2; exit 1; }
"$PYTHON_BIN" -c 'import hatchling' >/dev/null 2>&1 || {
printf 'hatchling is required in the release Python environment.\n' >&2
@@ -89,7 +90,7 @@ done
PACKAGE_ID=$("$PYTHON_BIN" -c \
'import hashlib,sys; h=hashlib.sha256(); [h.update(open(path,"rb").read()) for path in sys.argv[1:]]; print(h.hexdigest())' \
"$STAGED_APP_WHEEL" "$STAGE/app/runtime/runtime-core.txt")
printf '%s\n%s\n' "$PACKAGE_VERSION" "$PACKAGE_ID" >"$STAGE/app/runtime/VERSION"
printf '%s\n%s\n%s\n' "$PACKAGE_VERSION" "$APP_VERSION" "$PACKAGE_ID" >"$STAGE/app/runtime/VERSION"
"$PYTHON_BIN" "$PROJECT_ROOT/scripts/make_icons.py" "$STAGE"
chmod 0755 "$STAGE/cmd/"*
(
+1 -1
View File
@@ -17,7 +17,7 @@ SMOKE_PASSWORD="imagefind-smoke-password"
SMOKE_POSTGRES_TOKEN="${IMAGEFIND_SMOKE_POSTGRES_TOKEN:-}"
COOKIE_JAR="$DATA_ROOT/run/smoke-cookie.txt"
BACKUP_FILE="$DATA_ROOT/run/smoke.ifbackup"
EXPECTED_VERSION=$(sed -n '1p' "$APP_ROOT/runtime/VERSION")
EXPECTED_VERSION=$(sed -n '2p' "$APP_ROOT/runtime/VERSION")
APP_ROOT=$(CDPATH= cd -- "$APP_ROOT" && pwd)
[ "${#SMOKE_POSTGRES_TOKEN}" -ge 20 ] || {
+5
View File
@@ -26,6 +26,11 @@ grep -q '^runtime/wheels/.*\.whl$' "$work_dir/files.txt"
grep -q '^bin/libOpenCL.so.1$' "$work_dir/files.txt"
runtime_version=$(tar -xOzf "$work_dir/app.tgz" runtime/VERSION | sed -n '1p')
test "$runtime_version" = "$version"
runtime_app_version=$(tar -xOzf "$work_dir/app.tgz" runtime/VERSION | sed -n '2p')
runtime_package_id=$(tar -xOzf "$work_dir/app.tgz" runtime/VERSION | sed -n '3p')
test -n "$runtime_app_version"
test "${#runtime_package_id}" -eq 64
grep -q "^runtime/imagefind-${runtime_app_version}-.*\\.whl$" "$work_dir/files.txt"
if grep -Eq '^(data|models|cache|postgresql)/' "$work_dir/files.txt"; then
printf 'persistent data must not be included in ImageFind app.tgz\n' >&2
exit 1