fix upgrade strategy on 2 apps (#2195)

This commit is contained in:
Stavros Kois
2024-02-20 12:01:32 +02:00
committed by GitHub
parent a77f8727ba
commit 059c2e1510
2 changed files with 22 additions and 11 deletions

View File

@@ -16,6 +16,16 @@ def newer_mapping(image_tags):
if not version:
return {}
parts = version.split('.')
for idx, val in enumerate(parts):
if val == '0':
continue
if len(val) == 1:
parts[idx] = '0' + val
version = '.'.join(parts)
return {
'tags': {key: tags[version]},
'app_version': version,

View File

@@ -11,21 +11,22 @@ RE_STABLE_VERSION = re.compile(r'v\d+\.\d+\.\d+')
def newer_mapping(image_tags):
key = list(image_tags.keys())[0]
temp_tags = {t.strip('v'): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
# Strip leading zeros
tags = {}
for tag in temp_tags:
tag = tag.split('.')
for i in range(len(tag)):
# Remove leading zeros
tag[i] = tag[i].lstrip('0')
tags[tag] = '.'.join(tag)
tags = {t.strip('v'): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
return {}
parts = version.split('.')
for idx, val in enumerate(parts):
if val == '0':
continue
if len(val) == 1:
parts[idx] = '0' + val
version = '.'.join(parts)
return {
'tags': {key: tags[version]},
'app_version': version,