feat: git-based agent version reference and unified outdated badge (0.20.0)

SAC reads latest RDP/ssh-monitor versions from configured git repos for outdated detection, update targets, and settings test-git.
This commit is contained in:
2026-06-20 16:25:53 +10:00
parent d820d941c1
commit f411d8f070
22 changed files with 932 additions and 45 deletions
+62 -1
View File
@@ -1,6 +1,12 @@
"""Agent version parse/compare for outdated highlighting."""
from app.services.agent_version import is_agent_version_outdated, latest_agent_versions_by_product, parse_agent_version
from app.services.agent_version import (
effective_reference_version,
host_version_outdated,
is_agent_version_outdated,
latest_agent_versions_by_product,
parse_agent_version,
)
from app.models import Host
from datetime import datetime, timezone
@@ -27,6 +33,61 @@ def test_outdated_different_minor_or_major():
assert is_agent_version_outdated("2.1.0-SAC", latest) is False
def test_effective_reference_version_picks_max():
assert (
effective_reference_version(
recommended="2.1.0-SAC",
fleet_latest="2.0.6-SAC",
min_version="",
)
== "2.1.0-SAC"
)
assert (
effective_reference_version(
recommended="",
fleet_latest="2.0.6-SAC",
min_version="2.1.0-SAC",
)
== "2.1.0-SAC"
)
assert (
effective_reference_version(
recommended="",
fleet_latest="2.0.35-SAC",
min_version="",
)
== "2.0.35-SAC"
)
def test_host_version_outdated_ssh_vs_git():
assert (
host_version_outdated(
"2.0.6-SAC",
recommended="2.1.0-SAC",
fleet_latest="2.0.6-SAC",
)
is True
)
assert (
host_version_outdated(
"2.0.6-SAC",
recommended="",
fleet_latest="2.0.6-SAC",
)
is False
)
assert (
host_version_outdated(
"2.0.6-SAC",
recommended="",
fleet_latest="2.0.6-SAC",
min_version="2.1.0-SAC",
)
is True
)
def test_latest_agent_versions_by_product(db_session):
now = datetime.now(timezone.utc)
db_session.add_all(