fix(deploy-mining): ensure_kafka_image 输出到 stderr 避免被 $() 捕获

docker pull 在 group_info=$(run_kafka_cmd ...) 内执行时,stdout 被命令替换
捕获到变量中,屏幕无任何输出导致脚本看起来卡住。
- ensure_kafka_image 输出重定向到 stderr
- full_reset 开头显式预拉取镜像

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-01 22:42:42 -08:00
parent 0156be8d25
commit 2a5b51aa8d
1 changed files with 6 additions and 2 deletions

View File

@ -333,8 +333,9 @@ run_psql() {
ensure_kafka_image() {
local image="confluentinc/cp-kafka:7.5.0"
if ! docker image inspect "$image" &>/dev/null; then
log_info "Pulling Kafka CLI image: $image (first time only)..."
docker pull "$image"
# Output to stderr so it's visible even when called inside $(...) command substitution
echo -e "${BLUE}[INFO]${NC} Pulling Kafka CLI image: $image (first time only)..." >&2
docker pull "$image" >&2
fi
}
@ -1277,6 +1278,9 @@ full_reset() {
docker compose $COMPOSE_ARGS up -d postgres-2 redis-2 2>/dev/null || true
docker compose $COMPOSE_ARGS up -d --wait postgres-2 redis-2 2>/dev/null || sleep 15
log_success "Standalone infrastructure is up"
# Pre-pull Kafka CLI image (needed for cross-server kafka commands)
ensure_kafka_image
fi
log_step "Step 1/19: Stopping 2.0 services..."