Skip to content

Commit

Permalink
fix: semverCompare fails for non-semver tags, e.g. ´latest`
Browse files Browse the repository at this point in the history
  • Loading branch information
joshiste committed Dec 13, 2024
1 parent 3641aa6 commit e8a9c0a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/steadybit-platform/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/steadybit-platform/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down
7 changes: 7 additions & 0 deletions charts/steadybit-platform/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e8a9c0a

Please sign in to comment.