#!/bin/bash set -euo pipefail PROJECT_ROOT="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" . "$PROJECT_ROOT/scripts/init-security-env.sh" [ "$(read_env_value "$PROJECT_ROOT/.env" INFRASTRUCTURE_AUTO_UPDATE_ENABLED)" != false ] || exit 0 image="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE)" if [ -z "$image" ] || [[ "$image" =~ ^registry\.cn-shanghai\.aliyuncs\.com/comfy-ai/watchtower-aliyun:[0-9]+\.[0-9]+\.[0-9]+$ ]]; then write_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE registry.cn-shanghai.aliyuncs.com/comfy-ai/watchtower-aliyun:latest fi # Scope changes require the selected containers to receive matching labels. # A targeted update must not strand unchanged containers outside the new scope. image="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_IMAGE)" target="$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_UPDATE_TARGET)" if [ -z "${UPDATE_SERVICES:-}" ] && [ -z "$(read_env_value "$PROJECT_ROOT/.env" WATCHTOWER_SCOPE)" ] && [ "$image" = registry.cn-shanghai.aliyuncs.com/comfy-ai/watchtower-aliyun:latest ]; then case "$target" in ''|'easyai-updater'|'easyai-server easyai-wsgateway easyai-web') write_env_value "$PROJECT_ROOT/.env" WATCHTOWER_SCOPE easyai ;; esac fi