From e8a9c0a60127a5e050497f64b802a1927d79cbda Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Fri, 13 Dec 2024 15:56:33 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20semverCompare=20fails=20for=20non-semver?= =?UTF-8?q?=20tags,=20e.g.=20=C2=B4latest`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- charts/steadybit-platform/Chart.yaml | 2 +- charts/steadybit-platform/templates/_helpers.tpl | 2 +- charts/steadybit-platform/tests/deployment_test.yaml | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/charts/steadybit-platform/Chart.yaml b/charts/steadybit-platform/Chart.yaml index 410fc19..3b9c823 100644 --- a/charts/steadybit-platform/Chart.yaml +++ b/charts/steadybit-platform/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: steadybit-platform description: steadybit Platform Helm chart for Kubernetes. -version: 1.1.4 +version: 1.1.5 appVersion: 2.2.4 home: https://www.steadybit.com/ icon: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png diff --git a/charts/steadybit-platform/templates/_helpers.tpl b/charts/steadybit-platform/templates/_helpers.tpl index 30468f7..7d6ec09 100644 --- a/charts/steadybit-platform/templates/_helpers.tpl +++ b/charts/steadybit-platform/templates/_helpers.tpl @@ -137,7 +137,7 @@ returns the image tag for the platform container and validates wether a license */}} {{- define "validContainerImageTag" -}} {{- $version := default .Values.image.tag | default .Chart.AppVersion -}} -{{- if and (semverCompare ">=2.2.0-0" $version) (not .Values.platform.tenant.license) -}} +{{- if and (or (not (regexMatch "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$" $version)) (semverCompare ">=2.2.0-0" $version)) (not .Values.platform.tenant.license) -}} {{- fail ".Values.platform.license missing. A license is required to run steadybit platform >= 2.2.0" -}} {{- end -}} {{- $version -}} diff --git a/charts/steadybit-platform/tests/deployment_test.yaml b/charts/steadybit-platform/tests/deployment_test.yaml index eac5771..8319c40 100644 --- a/charts/steadybit-platform/tests/deployment_test.yaml +++ b/charts/steadybit-platform/tests/deployment_test.yaml @@ -101,6 +101,13 @@ tests: asserts: - failedTemplate: errorMessage: .Values.platform.license missing. A license is required to run steadybit platform >= 2.2.0 + - it: should fail with missing license for version latest + set: + image: + tag: latest + asserts: + - failedTemplate: + errorMessage: .Values.platform.license missing. A license is required to run steadybit platform >= 2.2.0 - it: should not fail with missing license for version >= 2.2.0 set: image: