Change how version with dashes are handled by so-docker-prune

This commit is contained in:
William Wernert
2021-05-25 11:25:12 -04:00
parent 7e008378ba
commit 192cec1825

View File

@@ -32,15 +32,15 @@ def get_image_version(string) -> str:
ver = string.split(':')[-1]
if ver == 'latest':
# Version doesn't like "latest", so use a high semver
return '999999.9.9'
return '99999.9.9'
else:
try:
Version(ver)
except InvalidVersion:
# Also return a very high (but less than 'latest') semver for automated branches
# since the image will most likely be the latest version
if any(substr in ver for substr in ['bravo', 'delta', 'foxtrot', 'kilo']):
return '99999.9.9'
# Also return a very high semver for any version
# with a dash in it since it will likely be a dev version of some kind
if '-' in ver:
return '999999.9.9'
return ver