feat(tenant): add brand publish-records list and harden enterprise site management

- Add GET /api/tenant/publish-records: brand-scoped paginated list that merges
  in-flight (queued/publishing) records ahead of history (success/failed/cancelled),
  enriched with article title and latest desktop task id; wire up
  service/handler/router/swagger/router_test
- Rework PublishManagementView to consume publish-records instead of desktop
  publish tasks; add publishRecordsApi + shared-types
  (ListPublishRecordsParams, PublishRecordListResponse)
- Enterprise site Update: distinguish explicit null from missing PATCH fields via
  EnterpriseSitePatchString, dedup site_url before write, verify RowsAffected,
  and map unique-constraint violations to a clear conflict
- MediaView: enterprise site edit/delete flows with favicon fallback handling
- Localize enterprise site / PBootCMS error messages to Chinese across the
  backend and the admin-web error map, plus legacy raw-message translation
- deploy: gate migration-coupled service rollouts behind RUN_MIGRATIONS unless
  ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT=true; handle empty SERVICES safely

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 11:40:46 +08:00
parent 67be43319e
commit a44ed21967
15 changed files with 1418 additions and 764 deletions
+55 -14
View File
@@ -34,6 +34,7 @@ REGISTRY_USERNAME="${REGISTRY_USERNAME:-root}"
REGISTRY_PASSWORD="${REGISTRY_PASSWORD:-}"
REGISTRY_PLAIN_HTTP="${REGISTRY_PLAIN_HTTP:-true}"
RUN_MIGRATIONS="${RUN_MIGRATIONS:-false}"
ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT="${ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT:-false}"
SKIP_DEPLOYMENTS="${SKIP_DEPLOYMENTS:-false}"
TARGET_PLATFORM="${TARGET_PLATFORM:-}"
CLEAN_LOCAL_IMAGES="${CLEAN_LOCAL_IMAGES:-false}"
@@ -60,6 +61,14 @@ DEPLOYABLE_SERVICES=(
ops-web
)
MIGRATION_GATED_SERVICES=(
tenant-api
ops-api
worker-generate
kol-assist-worker
scheduler
)
if [[ -z "${IMAGE_TAG}" ]]; then
echo "IMAGE_TAG is required. Use a unique tag, for example: IMAGE_TAG=$(git -C "${REPO_ROOT}" rev-parse --short=8 HEAD)-$(date +%Y%m%d%H%M%S)" >&2
exit 1
@@ -139,6 +148,14 @@ case "${RUN_MIGRATIONS}" in
;;
esac
case "${ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT}" in
true|false) ;;
*)
echo "ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT must be true or false." >&2
exit 1
;;
esac
case "${SKIP_DEPLOYMENTS}" in
true|false) ;;
*)
@@ -162,23 +179,44 @@ case "${WAIT_TIMEOUT}" in
;;
esac
for svc in "${SERVICES[@]}"; do
supported=false
for known in "${DEPLOYABLE_SERVICES[@]}"; do
if [[ "${svc}" == "${known}" ]]; then
supported=true
break
if [[ "${#SERVICES[@]}" -gt 0 ]]; then
for svc in "${SERVICES[@]}"; do
supported=false
for known in "${DEPLOYABLE_SERVICES[@]}"; do
if [[ "${svc}" == "${known}" ]]; then
supported=true
break
fi
done
if [[ "${supported}" != "true" ]]; then
echo "Unsupported service ${svc}. Pass deployment/container names only." >&2
exit 1
fi
done
if [[ "${supported}" != "true" ]]; then
echo "Unsupported service ${svc}. Pass deployment/container names only." >&2
exit 1
fi
done
fi
IMAGE_SERVICES=("${SERVICES[@]}")
if [[ "${RUN_MIGRATIONS}" != "true" && "${ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT}" != "true" ]]; then
for svc in "${SERVICES[@]}"; do
for gated in "${MIGRATION_GATED_SERVICES[@]}"; do
if [[ "${svc}" == "${gated}" ]]; then
echo "Refusing to roll ${svc} without RUN_MIGRATIONS=true." >&2
echo "Use ALLOW_SKIP_MIGRATIONS_FOR_APP_ROLLOUT=true only for a reviewed no-schema-change rollout." >&2
exit 1
fi
done
done
fi
IMAGE_SERVICES=()
if [[ "${#SERVICES[@]}" -gt 0 ]]; then
IMAGE_SERVICES=("${SERVICES[@]}")
fi
if [[ "${RUN_MIGRATIONS}" == "true" ]]; then
IMAGE_SERVICES=(migrate "${IMAGE_SERVICES[@]}")
if [[ "${#IMAGE_SERVICES[@]}" -gt 0 ]]; then
IMAGE_SERVICES=(migrate "${IMAGE_SERVICES[@]}")
else
IMAGE_SERVICES=(migrate)
fi
fi
if [[ "${#IMAGE_SERVICES[@]}" -eq 0 ]]; then
@@ -274,7 +312,10 @@ run_suffix="$(printf '%s-%s-%s' "${GITHUB_RUN_ID:-manual}" "${GITHUB_RUN_ATTEMPT
archive="/tmp/geo-rankly-images-${safe_tag}-${run_suffix}.tar"
remote_archive="${REMOTE_DIR}/geo-rankly-images-${safe_tag}-${run_suffix}.tar"
remote_lock_dir="${REMOTE_DIR}/.k3s-image-rollout.lock"
service_list="${SERVICES[*]}"
service_list=""
if [[ "${#SERVICES[@]}" -gt 0 ]]; then
service_list="${SERVICES[*]}"
fi
echo "==> Saving images:"
printf ' %s\n' "${images[@]}"