From c3a5aacd2120058e2e38361d72f7ce0b6b5229d3 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 29 Nov 2025 00:04:43 +0000 Subject: [PATCH] Fix standalone docker agent version comparison prefix mismatch The unified agent got the version normalization fix (1b866598), but the standalone docker agent's checkForUpdates() still used direct string comparison. When server returns "4.34.0" and agent has "v4.34.0", this caused an infinite self-update loop. Apply the same normalizeVersion() function used in the unified agent. Related to #773 --- internal/dockeragent/agent.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/dockeragent/agent.go b/internal/dockeragent/agent.go index 942e4a0..ec03975 100644 --- a/internal/dockeragent/agent.go +++ b/internal/dockeragent/agent.go @@ -1615,8 +1615,10 @@ func (a *Agent) checkForUpdates(ctx context.Context) { return } - // Compare versions - if versionResp.Version == Version { + // Compare versions - normalize by stripping "v" prefix for comparison. + // Server returns version without prefix (e.g., "4.33.1"), but agent's + // Version may include it (e.g., "v4.33.1") depending on build. + if normalizeVersion(versionResp.Version) == normalizeVersion(Version) { a.logger.Debug().Str("version", Version).Msg("Agent is up to date") return } @@ -1882,3 +1884,8 @@ func (a *Agent) selfUpdate(ctx context.Context) error { return nil } + +// normalizeVersion strips the "v" prefix from version strings for comparison. +func normalizeVersion(version string) string { + return strings.TrimPrefix(strings.TrimSpace(version), "v") +}