From 9082fbca1726b1effeb43acaafb9987fe25d5a31 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:18:44 +0200 Subject: [PATCH] fix pihole stategy (#2266) * fix pihole stategy * revert test changes * fmt * bump --- library/ix-dev/charts/pihole/Chart.yaml | 2 +- library/ix-dev/charts/pihole/upgrade_strategy | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/library/ix-dev/charts/pihole/Chart.yaml b/library/ix-dev/charts/pihole/Chart.yaml index 7a34c7abec..aee314a7f3 100644 --- a/library/ix-dev/charts/pihole/Chart.yaml +++ b/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' diff --git a/library/ix-dev/charts/pihole/upgrade_strategy b/library/ix-dev/charts/pihole/upgrade_strategy index e47d93e6a6..52afd46be5 100755 --- a/library/ix-dev/charts/pihole/upgrade_strategy +++ b/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)