Commit 1263f83
committed
fix(agent-update): stop stripping the pre-release suffix from the bundled agent version
util.GetVersionFromBinaryPath parsed the bundled agent binary with a regex that
captured only MAJOR.MINOR.PATCH, so an edge binary stamped 2.0.3-rc.116 was read
as "2.0.3". That value is what ServeAgentVersion advertises as latestVersion, and
CompareVersions correctly ranks a release above its pre-release, so once a host
had actually installed the rc the server kept reporting hasUpdate: true and the
agent re-downloaded the identical binary on every check.
handler/agent_version.go already carried the corrected pattern along with a
comment describing this exact failure; the util copy was never updated and the
two drifted. Promote the pattern to util.AgentVersionRe and alias the handler
constant to it so there is only one definition, which also means the existing
TestAgentVersionRe_CapturesPreRelease now guards both call sites.
alerts/agent_update.go shares the same helper, so the "Agent Files Update
Available" alert was likewise comparing a truncated current version against the
full DNS value.
Upgrades from an older release are unaffected: the numeric core decides before
the pre-release identifiers are consulted, so 2.0.2 still sees 2.0.3-rc.116 as an
update.1 parent 379225c commit 1263f83
2 files changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
0 commit comments