fix(cli): handle Docker SemVer build metadata in version parsing #5965 (#6024)

Description:
Corrects _parse_version to support Docker versions with SemVer build
metadata (e.g., 28.1.1+1), resolving #5965. Adds comprehensive unit
tests for version parsing, including normal, v-prefixed, prerelease,
build metadata, combined prerelease/build metadata, and edge cases with
missing components.

Issue:
Closes #5965

Dependencies:
None

---------

Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
This commit is contained in:
Sarath ak
2025-09-10 14:31:07 -04:00
committed by GitHub
co-authored by Sydney Runkle
parent bdef6b3f5d
commit f087567853
2 changed files with 25 additions and 1 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ def _parse_version(version: str) -> Version:
patch = "0"
else:
major, minor, patch = parts
return Version(int(major.lstrip("v")), int(minor), int(patch.split("-")[0]))
return Version(
int(major.lstrip("v")), int(minor), int(patch.split("-")[0].split("+")[0])
)
def check_capabilities(runner) -> DockerCapabilities: