fix(webui): compare a describe build's release, not its raw version, for drift

This commit is contained in:
sam committed 2026-10-24 02:17:53 +11:00
1 parent f63bab8908
commit fde50803e8
4 files changed
+38 -6

No files matched your search

+6 -4
View File
@@ -65,7 +65,7 @@ func (c *GitHubCatalog) Check(ctx context.Context) (Snapshot, error) {
}
}
return Snapshot{Components: []Component{
component("daemon", "Gateway", installedVersion(buildinfo.Version)),
component("daemon", "Gateway", ReleaseVersion(buildinfo.Version)),
component("agent", "Runtime", installedAgent(executableDir())),
}}, nil
}
@@ -192,7 +192,9 @@ func installable(r githubRelease) string {
return asset
}
func installedVersion(version string) string {
// ReleaseVersion is the release a build was cut from: a git-describe build
// ("1.55.0-218-gabc123") is the same release as its tag.
func ReleaseVersion(version string) string {
return buildSuffix.ReplaceAllString(version, "")
}
@@ -202,13 +204,13 @@ func installedVersion(version string) string {
func installedAgent(binDir string) string {
data, err := os.ReadFile(filepath.Join(binDir, agentVersionFile))
if binDir == "" || errors.Is(err, os.ErrNotExist) {
return installedVersion(buildinfo.Runtime)
return ReleaseVersion(buildinfo.Runtime)
}
version := strings.TrimSpace(string(data))
if err != nil || strings.ContainsAny(version, " \n") || ValidateChannel("exact-pin", version) != nil {
return ""
}
return installedVersion(version)
return ReleaseVersion(version)
}
func executableDir() string {