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>
这个提交包含在:
父节点
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/VERSION(repo 根目录静态文件,可能不准确)
|
||||
Path containerVersion = Paths.get("/app/VERSION");
|
||||
try {
|
||||
if (Files.exists(containerVersion)) {
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户