瀏覽代碼

fix collabora upgrade strategy (#1547)

Stavros Kois 1 年之前
父節點
當前提交
61cbafedad
共有 1 個文件被更改,包括 17 次插入2 次删除
  1. 17 2
      library/ix-dev/charts/collabora/upgrade_strategy

+ 17 - 2
library/ix-dev/charts/collabora/upgrade_strategy

@@ -16,6 +16,9 @@ def newer_mapping(image_tags):
     for tag in temp_tags:
         tag = tag.split('.')
         for i in range(len(tag)):
+            # Ignore the first two parts as they are supposed to have leading zeros
+            if i in [0, 1]:
+                continue
             # Add leading zero to single digit numbers
             if len(tag[i]) == 1:
                 tag[i] = '0' + tag[i]
@@ -26,9 +29,21 @@ def newer_mapping(image_tags):
     if not version:
         return {}
 
+    cleanVersion = ""
+    for idx, part in enumerate(version.split('.')):
+        # Ignore the first two parts as they are supposed to have leading zeros
+        if idx in [0, 1]:
+            cleanVersion += part + '.'
+            continue
+        # Remove leading zero
+        cleanVersion += part.lstrip('0') + '.'
+
+    # Remove trailing dot
+    cleanVersion = cleanVersion.rstrip('.')
+
     return {
-        'tags': {key: tags[version]},
-        'app_version': version,
+        'tags': {key: cleanVersion},
+        'app_version': cleanVersion,
     }