fix: readCurrentVersion 优先读 /app/SERVICE_VERSION,修复 currentVersion 永远返回 "1.0.0"

Dockerfile 中 COPY VERSION /app/VERSION 拷贝的是 repo 根目录的静态文件(始终是 "1.0.0"),
实际构建版本通过 build-arg SERVICE_VERSION 写入 /app/SERVICE_VERSION。
改为优先读 /app/SERVICE_VERSION,使 check-update 返回正确的 currentVersion。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-06-24 17:01:58 +08:00
父节点 b851a83e10
当前提交 1151724a2a

查看文件

@ -152,9 +152,17 @@ public class SystemUpdateService {
}
}
/** 读取镜像内打包的 VERSION 文件,返回当前版本号,文件不存在时返回 "unknown"。 */
/** 读取镜像内打包的版本号,返回当前版本号,文件不存在时返回 "unknown"。 */
public String readCurrentVersion() {
// 优先读镜像内 /app/VERSION
// Jenkins 构建时写入的实际版本号SERVICE_VERSION build-arg
Path serviceVersion = Paths.get("/app/SERVICE_VERSION");
try {
if (Files.exists(serviceVersion)) {
String v = Files.readString(serviceVersion).trim();
if (!v.isEmpty()) return v;
}
} catch (IOException ignored) {}
// 兼容旧镜像/app/VERSIONrepo 根目录静态文件可能不准确
Path containerVersion = Paths.get("/app/VERSION");
try {
if (Files.exists(containerVersion)) {