ZapretKVN-android/scripts/publish-local-stable.sh
loop-uh b0e35a2367
All checks were successful
Android CI / build (push) Successful in 9m33s
Crash section decided in one place, release pipeline checks git credentials up front
Diagnostics: the "Предыдущий сбой" section said "Есть сохранённый сбой приложения" for ANY
process-exit record, so an update kill (killDueToPackageUpdate) looked like a crash while the
summary card said all was fine. One pure function, crashSectionSummary(), now decides for both:
a crash is the app's own record or an exit with a crash reason (native_crash, java_crash, anr,
initialization_failure); quiet exits are named in plain words. isCrash() now also knows
java_crash and initialization_failure.

Release pipeline (three stops on 2026-11-13: stale rule set, a red unit test, git push without
credentials):
- scripts/lib/forgejo-git.sh wires the project credential helper through GIT_CONFIG_* when git
  has none and proves a push with a dry run; publish-local-stable.sh does it before any build.
- scripts/prepare-release.sh runs everything that comes before the publisher in the order that
  fails fastest: checks, all unit tests, verify-project, rule-set refresh, core pair, freeze
  commits, pushes, tag; --check is read-only, --publish continues into the publisher.
- scripts/test-forgejo-git.sh, run by verify-project.sh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-13 15:49:20 -05:00

455 lines
19 KiB
Shell
Executable file

#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TAG="${1:-}"
APPROVAL="${2:-}"
SIGNING_DIR="${ZAPRET_SIGNING_DIR:-${HOME:?HOME is required}/.zapret-kvn-signing}"
SIGNING_ENV="${ZAPRET_SIGNING_ENV:-$SIGNING_DIR/signing-secrets.env}"
if [[ ! -f "$SIGNING_ENV" && -f "$SIGNING_DIR/github-secrets.env" ]]; then
SIGNING_ENV="$SIGNING_DIR/github-secrets.env"
fi
SIGNING_STORE="$SIGNING_DIR/zapret-kvn-release.jks"
SIGNING_FINGERPRINT_FILE="$SIGNING_DIR/certificate-sha256.txt"
RELEASE_MATRIX_DIR="$PROJECT_ROOT/app/build/outputs/apk/matrix/release"
OUTPUT_DIR="$PROJECT_ROOT/build/local-release/$TAG"
STAGING_OUTPUT_DIR="$PROJECT_ROOT/build/local-release/.$TAG.staging"
RELEASE_REPOSITORY="${ZAPRET_UPDATE_REPOSITORY:-zapretkvn/ZapretKVN-android}"
FORGEJO_URL="${ZAPRET_FORGEJO_URL:-https://git.zapret.moe}"
FORGEJO_TOKEN_FILE="${ZAPRET_FORGEJO_TOKEN_FILE:-${HOME:?HOME is required}/.config/forgejo/zapret-kvn-android-release-token}"
# Single source of truth for the user-facing changelog, shared with the Forgejo
# release notes (create-release-bundle.sh).
RELEASE_CHANGES_FILE="${ZAPRET_RELEASE_CHANGES_FILE:-$PROJECT_ROOT/scripts/release-changes.txt}"
# Host-local ZapretGPT delivery helper that posts the Telegram announcement.
TELEGRAM_PUBLISHER="${ZAPRET_KVN_TG_PUBLISHER:-${HOME:?HOME is required}/zapretgpt/scripts/publish_zapretkvn_stable.py}"
# The bot may live in another container (since 2026-11-07: CT 202 on US2-7). Then
# ZAPRET_KVN_BOT_BRIDGE is the ssh alias of its bridge (a forced command on the bot
# side: kvn-state, kvn-publish ...) and the three APKs travel there by rsync.
# Empty: the bot runs on this machine, as before.
BOT_BRIDGE="${ZAPRET_KVN_BOT_BRIDGE:-}"
# F-Droid repository (since 2026-11-07 in CT 204, reached over ssh): the same three APKs as one tar on
# stdin, `ssh <alias> publish vX.Y.Z`. The receiver checks the names and the version, runs
# `zapret-fdroid publish-local` and `verify`, and returns the exit code; nothing stays behind on failure.
# Empty alias: the step is skipped (the periodic F-Droid synchronizer picks the release up from Forgejo).
FDROID_RECEIVER="${ZAPRET_KVN_FDROID_RECEIVER:-}"
# Bot-owned publish ledger; consulted after a publisher timeout to tell a false
# client timeout (the bot finished the upload anyway) from a real failure.
TELEGRAM_PUBLISHER_STATE="${ZAPRET_KVN_TG_STATE:-${HOME:?HOME is required}/zapretgpt/data/zapretkvn_publisher_state.json}"
# Succeeds when the bot ledger already records an Android artifact for this tag.
telegram_album_recorded() {
local state_source="$TELEGRAM_PUBLISHER_STATE"
if [[ -n "$BOT_BRIDGE" ]]; then
state_source="$(mktemp)"
ssh "$BOT_BRIDGE" kvn-state > "$state_source" 2>/dev/null || { rm -f "$state_source"; return 1; }
fi
python3 - "$state_source" "android|$TAG|" <<'PY'
import json, sys
path, prefix = sys.argv[1], sys.argv[2]
try:
with open(path, encoding="utf-8") as handle:
data = json.load(handle)
except (OSError, ValueError):
sys.exit(1)
published = data.get("published", data)
keys = published.keys() if isinstance(published, dict) else published
sys.exit(0 if any(isinstance(k, str) and k.startswith(prefix) for k in keys) else 1)
PY
local status=$?
[[ -n "$BOT_BRIDGE" ]] && rm -f "$state_source"
return $status
}
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ || "$APPROVAL" != --final-gate-approved ]]; then
echo "Usage: $0 vMAJOR.MINOR.PATCH --final-gate-approved" >&2
exit 1
fi
# This release pair was resolved once before source validation/commit. Dev,
# stable and resume all consume the same pin without selecting upstream again.
python3 "$PROJECT_ROOT/scripts/check_core_release_freeze.py" android "$TAG" --root "$PROJECT_ROOT"
for command in curl git jq keytool mv sha256sum stat timeout; do
command -v "$command" >/dev/null || {
echo "Missing required command: $command" >&2
exit 1
}
done
if [[ -n "${ZAPRET_FORGEJO_TOKEN:-}" ]]; then
FORGEJO_TOKEN="$ZAPRET_FORGEJO_TOKEN"
else
if [[ ! -f "$FORGEJO_TOKEN_FILE" || "$(stat -c '%a' "$FORGEJO_TOKEN_FILE")" != 600 ]]; then
echo "Forgejo token file must exist with mode 600: $FORGEJO_TOKEN_FILE" >&2
exit 1
fi
IFS= read -r FORGEJO_TOKEN < "$FORGEJO_TOKEN_FILE"
fi
if [[ -z "$FORGEJO_TOKEN" ]]; then
echo "Forgejo token is empty" >&2
exit 1
fi
RELEASE_PROBE="$(mktemp)"
trap 'rm -f -- "$RELEASE_PROBE"' EXIT
forgejo_api() {
curl --silent --show-error --fail \
--connect-timeout 20 --max-time 120 \
-H "Authorization: token $FORGEJO_TOKEN" \
-H 'Accept: application/json' \
"$@"
}
if [[ "$(stat -c '%a' "$SIGNING_DIR")" != 700 ]]; then
echo "Signing directory must have mode 700: $SIGNING_DIR" >&2
exit 1
fi
for private_file in "$SIGNING_ENV" "$SIGNING_STORE" "$SIGNING_FINGERPRINT_FILE"; do
if [[ ! -f "$private_file" || "$(stat -c '%a' "$private_file")" != 600 ]]; then
echo "Signing file must exist with mode 600: $private_file" >&2
exit 1
fi
done
cd "$PROJECT_ROOT"
if [[ "$(git branch --show-current)" != main ]]; then
echo "Stable releases must be published directly from main" >&2
exit 1
fi
if ! git diff --quiet || ! git diff --cached --quiet ||
[[ -n "$(git ls-files --others --exclude-standard)" ]]; then
echo "Stable releases require a clean worktree" >&2
exit 1
fi
# Git credentials for the tag push at the very end: wired here (a panel shell has no credential helper) and proven
# by a dry run below, so that a missing helper stops the release in seconds and not after the whole bundle is built.
# shellcheck source=lib/forgejo-git.sh
source "$PROJECT_ROOT/scripts/lib/forgejo-git.sh"
forgejo_git_credentials
git fetch origin main
if [[ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]]; then
echo "Local main must exactly match origin/main before publication" >&2
exit 1
fi
if [[ "$(git remote get-url origin)" != *"/$RELEASE_REPOSITORY.git" ]]; then
echo "Current repository does not match the updater release repository" >&2
exit 1
fi
if ! git show-ref --verify --quiet "refs/tags/$TAG"; then
echo "Create the stable tag on the release commit before publication: $TAG" >&2
exit 1
fi
if [[ "$(git rev-list -n 1 "$TAG")" != "$(git rev-parse HEAD)" ]]; then
echo "Stable tag must point to the current main commit: $TAG" >&2
exit 1
fi
forgejo_git_auth_check "refs/tags/$TAG" || exit 1
# The same changelog feeds the Forgejo notes and the Telegram announcement;
# reject what the bot would split or refuse before anything is published.
python3 "$PROJECT_ROOT/scripts/check-release-changes.py" "$RELEASE_CHANGES_FILE" || exit 1
# The packaged RU IP rule-set must be the latest upstream snapshot: a stale one
# routes new Russian ranges through the VPN in «Россия напрямую».
if [[ "${ZAPRET_ALLOW_STALE_RULE_SETS:-0}" != 1 ]]; then
python3 "$PROJECT_ROOT/scripts/refresh_rule_sets.py" --check || {
echo "Refresh rule-sets (scripts/refresh_rule_sets.py --write) and commit before a stable release," >&2
echo "or set ZAPRET_ALLOW_STALE_RULE_SETS=1 for an explicitly approved emergency release." >&2
exit 1
}
fi
remote_tag_commit="$(
{
git ls-remote origin "refs/tags/$TAG^{}"
git ls-remote origin "refs/tags/$TAG"
} | awk 'NR == 1 {print $1}'
)"
# The tag is pushed only after the bundle is built, verified and uploaded to a
# complete draft (publish-forgejo-stable.sh): a pushed tag is immutable, and a
# build, gate or upload failure must not burn it or expose a partial release.
if [[ -n "$remote_tag_commit" && "$remote_tag_commit" != "$(git rev-parse HEAD)" ]]; then
echo "Remote tag points to a different commit: $TAG" >&2
exit 1
fi
release_http="$(curl --silent --show-error \
--connect-timeout 20 --max-time 120 \
-H "Authorization: token $FORGEJO_TOKEN" \
-H 'Accept: application/json' \
--output "$RELEASE_PROBE" \
--write-out '%{http_code}' \
"$FORGEJO_URL/api/v1/repos/$RELEASE_REPOSITORY/releases/tags/$TAG")"
if [[ "$release_http" == 200 ]]; then
release_json="$(jq -ce . "$RELEASE_PROBE")"
# A draft, or a release Forgejo's tag sync already published after the
# complete upload; publish-forgejo-stable.sh verifies every asset byte and
# refuses an incomplete published release.
if ! jq -e \
--arg tag "$TAG" \
'.tag_name == $tag and .prerelease == false' \
<<<"$release_json" >/dev/null; then
echo "Forgejo Release already exists with another tag or as a prerelease: $TAG" >&2
exit 1
fi
if [[ ! -d "$OUTPUT_DIR" ]]; then
echo "Stable release exists, but its original local bundle is unavailable: $OUTPUT_DIR" >&2
echo "Refusing to rebuild potentially different assets or alter the release." >&2
exit 1
fi
echo "Found resumable stable release: $TAG"
elif [[ "$release_http" != 404 ]]; then
echo "Forgejo release probe failed with HTTP $release_http" >&2
exit 1
fi
# This file is owner-only and is the existing canonical local copy of the release
# credentials. Parse assignments as data so the credentials file is never executed.
declare -A signing_values=()
while IFS='=' read -r name value; do
case "$name" in
ANDROID_SIGNING_KEYSTORE_BASE64|ANDROID_SIGNING_STORE_PASSWORD|ANDROID_SIGNING_KEY_ALIAS|ANDROID_SIGNING_KEY_PASSWORD|ANDROID_SIGNING_CERT_SHA256)
if [[ -v "signing_values[$name]" ]]; then
echo "Duplicate signing variable: $name" >&2
exit 1
fi
signing_values["$name"]="$value"
;;
*)
echo "Unexpected entry in signing credentials file: $name" >&2
exit 1
;;
esac
done < "$SIGNING_ENV"
ANDROID_SIGNING_STORE_PASSWORD="${signing_values[ANDROID_SIGNING_STORE_PASSWORD]:-}"
ANDROID_SIGNING_KEY_ALIAS="${signing_values[ANDROID_SIGNING_KEY_ALIAS]:-}"
ANDROID_SIGNING_KEY_PASSWORD="${signing_values[ANDROID_SIGNING_KEY_PASSWORD]:-}"
ANDROID_SIGNING_CERT_SHA256="${signing_values[ANDROID_SIGNING_CERT_SHA256]:-}"
: "${ANDROID_SIGNING_STORE_PASSWORD:?Missing signing store password}"
: "${ANDROID_SIGNING_KEY_ALIAS:?Missing signing key alias}"
: "${ANDROID_SIGNING_KEY_PASSWORD:?Missing signing key password}"
: "${ANDROID_SIGNING_CERT_SHA256:?Missing signing certificate fingerprint}"
# shellcheck disable=SC1091
source "$PROJECT_ROOT/release.properties"
private_fingerprint="$(
tr '[:upper:]' '[:lower:]' < "$SIGNING_FINGERPRINT_FILE" | tr -d ':[:space:]'
)"
configured_fingerprint="$(
tr '[:upper:]' '[:lower:]' <<<"$ANDROID_SIGNING_CERT_SHA256" | tr -d ':[:space:]'
)"
export ZAPRET_SIGNING_STORE_PASSWORD="$ANDROID_SIGNING_STORE_PASSWORD"
jks_fingerprint="$(
keytool -exportcert \
-keystore "$SIGNING_STORE" \
-alias "$ANDROID_SIGNING_KEY_ALIAS" \
-storepass:env ZAPRET_SIGNING_STORE_PASSWORD \
| sha256sum \
| awk '{print $1}'
)"
if [[ ! "$RELEASE_SIGNER_SHA256" =~ ^[0-9a-f]{64}$ ]] ||
[[ "$private_fingerprint" != "$RELEASE_SIGNER_SHA256" ]] ||
[[ "$configured_fingerprint" != "$RELEASE_SIGNER_SHA256" ]] ||
[[ "$jks_fingerprint" != "$RELEASE_SIGNER_SHA256" ]]; then
echo "Production signing certificate does not match release.properties" >&2
exit 1
fi
while IFS='=' read -r name value; do
case "$name" in
ZAPRET_VERSION_NAME|ZAPRET_VERSION_CODE|ZAPRET_PRERELEASE|ZAPRET_RELEASE_CHANNEL)
export "$name=$value"
;;
*)
echo "Unexpected release variable: $name" >&2
exit 1
;;
esac
done < <("$PROJECT_ROOT/scripts/derive-release-version.sh" "$TAG")
if [[ "$ZAPRET_RELEASE_CHANNEL" != stable || "$ZAPRET_PRERELEASE" != false ]]; then
echo "Local publisher accepts stable tags only" >&2
exit 1
fi
latest_tag="$(forgejo_api "$FORGEJO_URL/api/v1/repos/$RELEASE_REPOSITORY/releases/latest" 2>/dev/null | jq -r '.tag_name // empty' || true)"
if [[ -n "$latest_tag" ]]; then
latest_version_code="$(
"$PROJECT_ROOT/scripts/derive-release-version.sh" "$latest_tag" \
| sed -n 's/^ZAPRET_VERSION_CODE=//p'
)"
if (( ZAPRET_VERSION_CODE <= latest_version_code )); then
echo "Stable versionCode must be newer than the latest published stable" >&2
exit 1
fi
fi
export ZAPRET_SIGNING_STORE_FILE="$SIGNING_STORE"
export ZAPRET_SIGNING_KEY_ALIAS="$ANDROID_SIGNING_KEY_ALIAS"
export ZAPRET_SIGNING_KEY_PASSWORD="$ANDROID_SIGNING_KEY_PASSWORD"
export ZAPRET_EXPECTED_SIGNER_SHA256="$RELEASE_SIGNER_SHA256"
export ZAPRET_REQUIRE_SIGNED_RELEASE=1
export ZAPRET_UPDATE_REPOSITORY="$RELEASE_REPOSITORY"
if [[ -e "$OUTPUT_DIR" && ! -d "$OUTPUT_DIR" ]]; then
echo "Local release output path is not a directory: $OUTPUT_DIR" >&2
exit 1
fi
if [[ -d "$OUTPUT_DIR" ]]; then
echo "Reusing existing local release bundle after full verification: $OUTPUT_DIR"
"$PROJECT_ROOT/scripts/verify-release-bundle.sh" "$TAG" "$OUTPUT_DIR"
else
if [[ -e "$STAGING_OUTPUT_DIR" ]]; then
echo "Incomplete staging output exists; move it aside before retrying: $STAGING_OUTPUT_DIR" >&2
exit 1
fi
"$PROJECT_ROOT/scripts/ci-build.sh"
"$PROJECT_ROOT/scripts/create-release-bundle.sh" \
"$TAG" \
"$RELEASE_MATRIX_DIR" \
"$STAGING_OUTPUT_DIR"
"$PROJECT_ROOT/scripts/verify-release-bundle.sh" "$TAG" "$STAGING_OUTPUT_DIR"
mv "$STAGING_OUTPUT_DIR" "$OUTPUT_DIR"
echo "Promoted verified release bundle atomically: $OUTPUT_DIR"
fi
# publish-forgejo-stable.sh pushes the tag itself, only after the draft holds
# the complete verified asset set (Forgejo publishes a draft when it syncs its
# tag, so an earlier push can expose a partial release).
"$PROJECT_ROOT/scripts/publish-forgejo-stable.sh" \
"$TAG" \
"$OUTPUT_DIR" \
"$RELEASE_REPOSITORY"
# F-Droid comes after the verified Forgejo release and before Telegram. It never fails the release:
# the Forgejo release is immutable and the periodic F-Droid synchronizer retries the same assets.
publish_to_fdroid() {
local marker="$OUTPUT_DIR/.fdroid-published" abi
local apk_names=()
if [[ "${ZAPRET_SKIP_FDROID:-0}" == 1 ]]; then
echo "Skipping F-Droid (ZAPRET_SKIP_FDROID=1)."
return 0
fi
if [[ -f "$marker" ]]; then
echo "F-Droid already has $TAG; skipping."
return 0
fi
if [[ -z "$FDROID_RECEIVER" ]]; then
echo "F-Droid receiver is not configured (ZAPRET_KVN_FDROID_RECEIVER); the periodic synchronizer will pick $TAG up from Forgejo."
return 0
fi
for abi in arm64-v8a armeabi-v7a x86_64; do
apk_names+=("Zapret-KVN-$TAG-$abi.apk")
[[ -s "$OUTPUT_DIR/Zapret-KVN-$TAG-$abi.apk" ]] || {
echo "F-Droid step: missing $OUTPUT_DIR/Zapret-KVN-$TAG-$abi.apk" >&2
return 1
}
done
echo "Publishing $TAG to F-Droid through $FDROID_RECEIVER ..."
if tar -C "$OUTPUT_DIR" -cf - "${apk_names[@]}" \
| timeout 1800 ssh -o BatchMode=yes -o ConnectTimeout=20 "$FDROID_RECEIVER" publish "$TAG"; then
: > "$marker"
echo "F-Droid published $TAG."
else
echo "WARNING: the F-Droid step failed for $TAG; the Forgejo release stays; the synchronizer retries, or run this script again." >&2
return 1
fi
}
publish_to_fdroid || echo "F-Droid step incomplete (see above); continuing with Telegram." >&2
# Telegram announcement is the mandatory final step of a stable release (unless
# explicitly skipped): the Forgejo release is now visible, so announce it once
# through the host-local ZapretGPT bot using the SAME changelog the Forgejo notes
# were built from. Idempotent via a per-bundle marker so a resumed publish does
# not double-post.
telegram_marker="$OUTPUT_DIR/.telegram-published"
if [[ "${ZAPRET_SKIP_TELEGRAM:-0}" == 1 ]]; then
echo "Skipping Telegram announcement (ZAPRET_SKIP_TELEGRAM=1)."
elif [[ -f "$telegram_marker" ]]; then
echo "Telegram announcement already sent for $TAG; skipping."
else
[[ -f "$RELEASE_CHANGES_FILE" ]] || {
echo "Missing changelog source: $RELEASE_CHANGES_FILE" >&2
exit 1
}
if [[ -z "$BOT_BRIDGE" ]]; then
[[ -f "$TELEGRAM_PUBLISHER" ]] || {
echo "Telegram publisher not found: $TELEGRAM_PUBLISHER" >&2
exit 1
}
else
ssh "$BOT_BRIDGE" kvn-check >/dev/null || {
echo "Bot bridge check failed: $BOT_BRIDGE" >&2
exit 1
}
fi
telegram_changes=()
while IFS= read -r change_line || [[ -n "$change_line" ]]; do
[[ -z "${change_line// }" || "$change_line" == \#* ]] && continue
telegram_changes+=(--change "${change_line# }")
done < "$RELEASE_CHANGES_FILE"
if (( ${#telegram_changes[@]} == 0 )); then
echo "No changelog items to announce in $RELEASE_CHANGES_FILE" >&2
exit 1
fi
if [[ -n "$BOT_BRIDGE" ]]; then
# Bot reads the bundle from its own disk: push the three APKs, then publish over ssh
# (the remote shell re-parses the line, so every argument is quoted).
# The bridge accepts only an exact file name (android/vX.Y.Z/Zapret-KVN-vX.Y.Z-<abi>.apk),
# never a directory target, so the APKs go one by one.
bridge_apks=("$OUTPUT_DIR"/Zapret-KVN-"$TAG"-*.apk)
[[ -e "${bridge_apks[0]}" ]] || {
echo "No APKs to push to the bot bridge in $OUTPUT_DIR" >&2
exit 1
}
for bridge_apk in "${bridge_apks[@]}"; do
rsync -t --partial "$bridge_apk" "$BOT_BRIDGE:android/$TAG/$(basename "$bridge_apk")" || {
echo "Could not push $(basename "$bridge_apk") to the bot bridge." >&2
exit 1
}
done
bridge_command=(ssh "$BOT_BRIDGE" kvn-publish android "${TAG#v}")
for bridge_arg in "${telegram_changes[@]}"; do
bridge_command+=("$(printf '%q' "$bridge_arg")")
done
publish_command=("${bridge_command[@]}")
else
publish_command=(python3 "$TELEGRAM_PUBLISHER" android "${TAG#v}" "${telegram_changes[@]}")
fi
if "${publish_command[@]}"; then
: > "$telegram_marker"
echo "Telegram announcement published for $TAG."
else
# A client-side timeout is not proof of failure: over DPI-throttled MTProto
# the bot often finishes the upload after the client gives up. Give it a
# bounded grace period and trust the bot's publish ledger before failing.
echo "Telegram publisher exited non-zero; checking whether the album landed anyway…" >&2
for _ in $(seq 1 20); do
if telegram_album_recorded; then
: > "$telegram_marker"
echo "Telegram album for $TAG confirmed in the bot ledger despite the client timeout."
break
fi
sleep 30
done
if [[ ! -f "$telegram_marker" ]]; then
echo "Stable $TAG published, but the Telegram announcement failed; re-run to retry." >&2
exit 1
fi
fi
fi
"$PROJECT_ROOT/scripts/prune-local-archive.sh" "$PROJECT_ROOT/build/local-release" "$TAG" \
|| echo "Warning: local release archive pruning failed." >&2
dispatch_payload="$(jq -n --arg tag "$TAG" '{ref:"main",inputs:{tag:$tag}}')"
if forgejo_api \
--request POST \
-H 'Content-Type: application/json' \
--data "$dispatch_payload" \
"$FORGEJO_URL/api/v1/repos/$RELEASE_REPOSITORY/actions/workflows/release-verify.yml/dispatches" \
>/dev/null; then
echo "Stable $TAG published; independent Forgejo Actions verification was dispatched."
else
echo "Stable $TAG was published, but background Forgejo verification dispatch failed." >&2
exit 1
fi