Quellcode durchsuchen

fix pihole stategy (#2266)

* fix pihole stategy

* revert test changes

* fmt

* bump
Stavros Kois vor 1 Jahr
Ursprung
Commit
9082fbca17

+ 1 - 1
library/ix-dev/charts/pihole/Chart.yaml

@@ -3,7 +3,7 @@ description: DNS and Ad-filtering for your network.
 annotations:
   title: Pi-hole
 type: application
-version: 2.0.6
+version: 2.0.7
 apiVersion: v2
 appVersion: 2024.02.0
 kubeVersion: '>=1.16.0-0'

+ 13 - 5
library/ix-dev/charts/pihole/upgrade_strategy

@@ -17,12 +17,20 @@ def newer_mapping(image_tags):
         return {}
 
     parts = version.split('.')
-    for idx, val in enumerate(parts):
-        if val == '0':
-            continue
 
-        if len(val) == 1:
-            parts[idx] = '0' + val
+    # Versioning scheme:
+    # Must be x.y.z
+    # Second part has leading 0 if not 0
+    # Third part does not have leading 0
+
+    # Below we make sure the above conditions are met
+    # as the semantic_versioning function modifies the version
+
+    if len(parts) < 3:
+        return {}
+
+    if parts[1] != '0':
+        parts[1] = '0' + parts[1]
 
     version = '.'.join(parts)